Force a URL to HTTPS using Kemp Loadmaster and Nginx

On the Kemp Loadmaster, do a request header modification, adding the HTTPS: on header.

  • View/Modify Services
  • Click the “Modify” button on  your port 443 service you have already set up
  • Under Advanced Properties,  click Show Header Rules under HTTP Header Modifications
  • Click Add  on “Add Header: HTTPS” under Request Rules

Now in your backend app or webserver you need to check for that header.  In nginx you can do this:


location /admin/ {
if ($http_https != on) {
return 301 https://www.tacmedsolutions.com$request_uri;
}
proxy_set_header host www.boxtricks.com;
proxy_pass http://127.0.0.1:8000;
}

This entry was posted in Kemp, Linux, nginx. Bookmark the permalink.

Comments are closed.