Welcome! Log In Create A New Profile

Advanced

Re: Redirect loop problems

October 14, 2014 01:38AM
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@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Redirect loop problems

dewanggaba October 14, 2014 01:04AM

Re: Redirect loop problems

dewanggaba October 14, 2014 01:38AM

RE: Redirect loop problems

crazy world October 14, 2014 01:04PM

Re: Redirect loop problems

dewanggaba October 15, 2014 11:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 152
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready