github.com/vmware/go-vmware-nsxt@v0.0.0-20230223012718-d31b8a1ca05e/loadbalancer/lb_http_redirect_action.go (about) 1 /* 2 * NSX API 3 * 4 * VMware NSX REST API 5 * 6 * API version: 1.0.0 7 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) 8 */ 9 10 package loadbalancer 11 12 // This action is used to redirect HTTP request messages to a new URL. The reply_status value specified in this action is used as the status code of HTTP response message which is sent back to client (Normally a browser). The HTTP status code for redirection is 3xx, for example, 301, 302, 303, 307, etc. The redirect_url is the new URL that the HTTP request message is redirected to. Normally browser will send another HTTP request to the new URL after receiving a redirection response message. Captured variables and built-in variables can be used in redirect_url field. For example, to redirect all HTTP requests to HTTPS requests for a virtual server. We create an LbRule without any conditions, add an LbHttpRedirectAction to the rule. Set the redirect_url field of the LbHttpRedirectAction to: https://$_host$_request_uri And set redirect_status to \"302\", which means found. This rule will redirect all HTTP requests to HTTPS server port on the same host. 13 type LbHttpRedirectAction struct { 14 15 // Type of load balancer rule action 16 Type_ string `json:"type"` 17 18 // HTTP response status code 19 RedirectStatus string `json:"redirect_status"` 20 21 // The URL that the HTTP request is redirected to 22 RedirectUrl string `json:"redirect_url"` 23 }