Welcome! Log In Create A New Profile

Advanced

Starting to redirect HTTP to HTTPS without breaking POST requests

August 19, 2014 07:30PM
Hi,

in a single server block listening on both 80 and 443 ssl, currently in production, I want to start redirecting all HTTP GET requests to HTTPS ... but keep serving non-GET requests on HTTP for a little while, so as not to bork form posts and such made by clients from pages loaded on HTTP before the change.

This can probably be accomplished by either:

(a) using the kludgy multi-condition if-hack (checking both $scheme = http and $request_method = GET) as in https://gist.github.com/jrom/1760790

(b) duplicating the server block, one for HTTP and one HTTPS, and adding an if ($request_method = GET) block in the HTTP one?

... but is there some neater way?

Thanks, best regards,

Gulli
Subject Author Posted

Starting to redirect HTTP to HTTPS without breaking POST requests

gthb August 19, 2014 07:30PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 78
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready