The documentation and HA Proxy guide seem to be showing me to many use cases. I just have the very simple case
where I have a Virtual Server setup for https://foo.com. But in the event that someone happens to type in http://foo.com
I want direct them to https://foo.com. What are the minimum number of statements in an Application Rule in order
to be able to accomplish this? Thank you.
The example int he documentation is below. But that looks to me like it's more than I need.
HTTP/HTTPS redirection based on condition
An application profile allows you to specify HTTP/HTTPS redirection, which always redirects traffic regardless of the request URLs. You also have the flexibility to specify the conditions in which HTTP/HTTPS traffic should be redirected.
move the login URL only to HTTPS.
acl clear dst_port 80
acl secure dst_port 8080
acl login_page url_beg /login
acl logout url_beg /logout
acl uid_given url_reg /login?userid=[^&]+
acl cookie_set hdr_sub(cookie) SEEN=1
redirect prefix https://mysite.com set-cookie SEEN=1 if !cookie_set
redirect prefix https://mysite.com if login_page !secure
redirect prefix http://mysite.com drop-query if login_page !uid_given
redirect location http://mysite.com/ if !login_page secure
redirect location/ clear-cookie USERID= if logout
There are 2 options
Option 1: Use Application Profile
- Create application profile type HTTP, put HTTP Redirect URL as: https://foo.com
- Edit Virtual Server and apply the Application Profile
This option can redirect to different URL e.g. from http://foo.com to https://newfoo.com
Option 2.
- Create Application Rule as below to redirect HTTP request to the same URI but HTTPS
redirect scheme https if !{ ssl_fc }
- Edit Virtual Server and apply the Application profile
These 2 options are documented in the NSX 6.2 LB configuration examples here: NSX-6.2 - LB configuration examples
Below blog explains the configuration how to achieve redirection from http://<URL> to https:<URL>
Let me know if this is useful & it works for your scenario.
There are 2 options
Option 1: Use Application Profile
- Create application profile type HTTP, put HTTP Redirect URL as: https://foo.com
- Edit Virtual Server and apply the Application Profile
This option can redirect to different URL e.g. from http://foo.com to https://newfoo.com
Option 2.
- Create Application Rule as below to redirect HTTP request to the same URI but HTTPS
redirect scheme https if !{ ssl_fc }
- Edit Virtual Server and apply the Application profile
These 2 options are documented in the NSX 6.2 LB configuration examples here: NSX-6.2 - LB configuration examples