Redirect loop problems

Dewangga Bachrul Alam dewanggaba at xtremenitro.org
Wed Oct 15 15:08:08 UTC 2014


Hi,

Problem solved, on conf.d directory, there is active HSTS directive,
that's why the HTTP forcing to HTTPS, wherever I force them back to http.

Thanks anyway.

On 10/15/2014 12:02 AM, crazy world wrote:
> Can you grab the http conversation from the browser or run tcpdump to show the difference between curl and the browser? The client sends the different thing to the server which is confirmed.
> 
> -B
> 
>> Date: Tue, 14 Oct 2014 12:37:33 +0700
>> From: dewanggaba at xtremenitro.org
>> To: nginx at nginx.org
>> Subject: Re: Redirect loop problems
>>
>> Update:
>>
>> I just want to redirect specific URL contains `/go/*` to HTTP, and force
>> others to HTTPS.
>>
>> On 10/14/2014 12:03 PM, Dewangga Bachrul Alam wrote:
>>> Hi,
>>>
>>> Today, I was implement redirect using return 301, here's my snippet:
>>>
>>> server {
>>>         listen 80;
>>>         server_name domain.tld;
>>>         error_log       /dev/null;
>>>         access_log      off;
>>>         return 301 https://www.domain.tld$request_uri;
>>> }
>>>
>>> server {
>>> 	listen 80;
>>> 	server_name www.domain.tld;
>>>         error_log       /dev/null;
>>>         access_log      off;
>>>
>>> location ^~ /go/ {
>>> 	# Apache2 Backend
>>> 	proxy_pass http://127.0.0.1:8080
>>> }
>>> location / {
>>> 	return 301 https://$http_host$request_uri$is_args$query_string;
>>> }
>>> }
>>>
>>> server {
>>>         listen 443 ssl spdy;
>>>         server_name     domain.tld;
>>>         return 301 https://www.domain.tld$request_uri;
>>>
>>>         error_log       /dev/null;
>>>         access_log      off;
>>>
>>>         ssl on;
>>>         ssl_certificate         bundle.crt;
>>>         ssl_certificate_key     file.key;
>>>         ssl_verify_depth 2;
>>> }
>>>
>>> server {
>>> 	listen 443 ssl spdy;
>>> 	server_name www.domain.tld;
>>> location ^~ /go/ {
>>> 	return 301 http://$http_host$request_uri;
>>> }
>>> location / {
>>> 	# Apache2 Backend
>>> 	proxy_pass http://127.0.0.1:8080
>>> }
>>> }
>>>
>>> The problem is, if the visitor hit `/go/` URL, the browser says it's
>>> redirect loop, but if I try `curl -I` command the `/go/` URL, it's
>>> normal, and says HTTP 200.
>>>
>>> Any hints? Really appreciate any helps.
>>>
>>
>> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>  		 	   		  
> 
> 
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
> 



More information about the nginx mailing list