/api/v1/website
Add a Website
Adds a website for WSM to monitor/protect.
URL
/api/v1/website
HTTP Method
POST
POST Parameters
Parameter |
Required |
Type |
Description |
Acceptable Values |
---|---|---|---|---|
deployment |
true |
string containing integer |
Specifies the Deployment Mode. For Routing Proxy, IP Forwarding must be enabled. |
"1" → Reverse Proxy |
enable_hcd |
false |
string containing integer |
Specifies whether to enable health checking. |
"0" → False |
init_conf |
true |
string |
Specifies the initial configuration to apply. If set to "template", a valid template filename must be provided in the template parameter. |
"waf_default" |
ip |
true |
string containing ip or "*" |
Specifies the listen IP. If running in AWS or Azure, this must be set to "*" if present. |
"<ip address>" |
preserve_client_ip |
false |
string containing integer |
Specifies whether to configure as a Transparent Proxy (preserve's the client's IP) This is not available when running in AWS or Azure. |
"0" → False |
rhost |
true |
array of strings containing ip addresses or public domain names |
Specifies the IP address(es) and hostname(s) of the web-server(s) to proxy traffic to. Cannot bind to a loopback address (127.*.*.*) |
["<ip address>", "<ip address>", ...] |
rhost_alt_port |
false |
array of strings containing integers |
Specifies alternate port(s) to use when reaching the protected web-servers(s). Only required when rhost_proto is set to "both". |
["<port num>", "<port num>", ...] |
rhost_port |
true |
array of strings containing integers |
Specifies the port(s) to use when reaching the protected web-server(s). |
["<port num>", "<port num>", ...] |
rhost_proto |
true |
string |
Specifies the protocol to use when reaching the protected web-server(s). When set to "both", rhost_alt_port is required. |
"http" |
rhost_role |
true |
array of strings containing integers |
Specifies the role of the protected web-server(s). Active means that requests will be forwarded to the server. When Backup is selected the server will only be used if no Active servers are in operation. Down means that the server should not be used - for instance if it is down for maintenance. |
"1" → Active |
template |
true |
string containing template filename |
Specifies the filename of the template to use. The file must exist if init_conf is set to "template". Otherwise this parameter is not used (convention is to supply "0" if not used). |
"<filename>" |
vhost |
true |
string containing ip address |
Specifies the hostname of the Virtual Web Server. Cannot bind to a loopback address (127.*.*.*) |
"<ip address>" |
vhost_alt_port |
false |
string containing integer |
Specifies the alternate port to listen on for the Virtual Web Server. Only required when vhost_proto is set to "both". Represents the HTTP listen port. |
"<port num>" |
vhost_port |
true |
string containing integer |
Specifies the port to listen on for the Virtual Web Server. Represents the HTTPS listen port when vhost_proto is set to "both". Cannot be set to 4849 (reserved for the management UI) |
"<port num>" |
vhost_proto |
true |
string |
Specifies the protocol to use for the Virtual Web Server. When set to "both", vhost_alt_port is required. Cannot be set to 4849 (reserved for the management UI) or equal to vhost_port. Must be set to "https" or "both" if rhost_proto is set to "https" or "both". |
"http" |
Response Parameters
Parameter |
Type |
Description |
---|---|---|
mode |
string containing integer |
The proxy mode of the website "0" → Pass Mode |
status |
string containing integer |
The status of the website "0" → Disabled |
name |
string |
Proxy name |
rhost |
array of rhost_details |
Details about the ip address(es)/hostname(s) of the protected web-server(s) |
bind |
array of strings containing ip or "*" |
The listen IP (corresponds with "ip" above) |
mirror_of |
string containing integer |
Indicates which Proxy ID that the Policy is mirrored from. A value of "0" indicates no mirroring is enabled. |
sec |
security_policy |
Details regarding the policy |
vhost |
vhost_details |
Details about the Virtual Web Server |
deployment |
string containing integer |
The Deployment Mode "1" → Reverse Proxy |
id |
string containing integer |
Proxy ID |
rhost_details
An rhost_details object is an array containing the following
Index |
Parameter |
Type |
Description |
---|---|---|---|
0 |
rhost_proto |
string |
The protocol used when reaching the protected web-server |
1 |
rhost |
string containing IP address or hostname |
The IP address or hostname of the web-server to proxy traffic to |
2 |
rhost_port |
string containing integer |
The port to use when reaching the protected web-server |
3 |
rhost_role |
string containing integer |
The role of the protected web-server
|
4 |
rhost_status |
string containing integer |
The status of the protected web-server "0" → ERROR |
5 |
rhost_alt_port |
string containing integer |
The alternate port to use when reaching the protected web-server |
security_policy
Parameter |
Type |
Description |
---|---|---|
ts |
string containing integer |
The tuning status of the proxy "0" → Working |
vhost_details
Parameter |
Type |
Description |
---|---|---|
proto |
string |
The protocol of the Virtual Web Server |
port2 |
string containing integer |
The HTTP listen port of the Virtual Web Server when proto is set to "both" |
as |
-- |
Depcrecated |
proxy_protocol_enabled |
string containing integer |
Indicates whether proxy protocol is enabled |
name |
string |
The name of the Virtual Web Server |
port |
string containing integer |
The primary listen port of the Virtual Web Server. Represents the HTTPS listen port when proto is set to "both" |
Example: Add an HTTP website
Request
curl -kv
-u api_ninja:ninja_password
-X POST
-H 'Content-Type: text/json'
--data-binary @addsite.json
https://172.31.1.172:4849/api/v1/website
POST Parameters
{ "deployment": "1", "enable_hcd": "0", "init_conf": "waf_default", "ip": "*", "rhost": [ "192.168.100.5" ], "rhost_alt_port": [], "rhost_port": [ "80" ], "rhost_proto": "http", "rhost_role": [ "1" ], "template": "0", "vhost": "restful.demo.ba", "vhost_alt_port": "", "vhost_port": "80", "vhost_proto": "http" }
Response
{ "mode": "3", "status": "1", "name": "example", "rhost": [ ["http", "192.168.100.5", "80", "1", "1", "443"] ], "bind": ["*"], "mirror_of": "0", "sec": { "ts": "0" }, "vhost": { "proto": "http", "port2": "", "as": "", "proxy_protocol_enabled": "0", "name": "example.one.com", "port": "80" }, "deployment": "1", "id": "5" }
Example: Add a website which uses HTTP and HTTPS on non-standard ports, with 2 backend servers (one active, one backup)
Request
/api/v1/website
curl -Kv
-u api_ninja:ninja_password
-X POST
-H 'Content-Type: text/json'
--data-binary @addsite2.json
https://172.31.1.172:4849/api/v1/website
POST Parameters
{ "deployment": "1", "enable_hcd": "0", "init_conf": "waf_default", "ip": "*", "rhost": [ "www.example.com", "1.2.3.4" ], "rhost_alt_port": [ "4433", "4433" ], "rhost_port": [ "8080", "8080" ], "rhost_proto": "both", "rhost_role": [ "1", "2"], "template": "0", "vhost": "example.two.com", "vhost_alt_port": "8080", "vhost_port": "4433", "vhost_proto": "both" }
Response
{ "mode": "3", "status": "1", "name": "example", "rhost": [ ["both", "www.example.com", "8080", "1", "1", "4433"], ["both", "1.2.3.4", "8080", "2", "1", "4433"] ], "bind": ["*"], "mirror_of": "0", "sec": { "ts": "0" }, "vhost": { "proto": "both", "port2": "8080", "as": "", "proxy_protocol_enabled": "0", "name": "example.two.com", "port": "4433" }, "deployment": "1", "id": "6" }