For Techs.... Techniques.... Technologies....


How to disable https for specific path in Nginx under AWS loadbalancer

Recently we have faced a redirect loop for some specific urls in the application which is configured to access through Nginx under AWS loadbalancer with https.

In-order to solve this problem we need to disable https for that particular path in Nginx.

We can disable the same by adding the following lines to virtualhost configuration unde the corresponding path location.

 if ($http_x_forwarded_proto = "https") {
  rewrite ^ http://$host$uri permanent;

Since there is a change in configuration, we need to restart the Nginx service.

Now https will be disabled only for that particular path.

Please note that if we need to disable https for all paths, the above rule need to be configured under "/" location directive.

That's all…

Leave a Reply