Problem with return 302 redirection, with Nginx 1.3.11 + Drupal 7
António P. P. Almeida
appa at perusio.net
Wed Jan 23 13:13:10 UTC 2013
On 23 Jan 2013 12h46 CET, m6rkalan at gmail.com wrote:
> Hello,
>
> In order to redirect certain Drupal 7 functions to https I have
> setup Nginx 1.3.11 as follows:
>
> location ~* ^/(\?q=)?(?:user|admin|contact$) {
> return 302 https://$host$request_uri;
> }
Locations don't match the query string part.
At the http level:
map $arg_q $q_secure {
default 0;
~(?:user|admin|contact) 1;
}
map $uri $u_secure {
default 0;
~^/(?:user|admin|contact) 1;
}
map $q_secure$u_secure $secure {
default 0;
10 1;
01 1;
}
At the server level:
if ($secure) {
return 302 https://$host$request_uri;
}
Try it.
--- appa
More information about the nginx
mailing list