I'm trying to redirect requests to https in nginx, unless it is of the form HOST/ANY_STRING_OF_CHARS/END_OF_URI, e.g.:
http://host.org/about # no redirect
http://host.org/users/sign_in # redirects to https://host.org/users/sign_in
This apparently works in Apache, but I don't understand how the bang works (ignore if it doesn't really work):
RewriteRule !/([a-z]+)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
How can I do this in a nginx rewrite rule? This is not working as I'd hoped:
rewrite !/([a-z]+)$ https://$server_name$request_uri redirect;
This doesn't do the redirect either, in case I had the logic backwards:
rewrite /([a-z]+)$ https://$server_name$request_uri redirect;
Help please?