Forum: NGINX Starting to redirect HTTP to HTTPS without breaking POST requests

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
gthb (Guest)
on 2014-08-20 01:30
(Received via mailing list)

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
bork form posts and such made by clients from pages loaded on HTTP
the change.

This can probably be accomplished by either:

(a) using the kludgy multi-condition if-hack (checking both $scheme =
and $request_method = GET) as in

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

... but is there some neater way?

Thanks, best regards,


Posted at Nginx Forum:,252683,252683#msg-252683
This topic is locked and can not be replied to.