python - Django + nginx redirect loop for home / -


i've strange problem. it's not first page i've published in way first behavior.

my site configured redirect: http://marclab.de http://marclab.de/

but

it redirects http://marclab.de/ http://marclab.de/?

the browser seems compensate misconfiguration, google not.

i've 2 curl calls:

~ $ curl -v http://marclab.de * rebuilt url to: http://marclab.de/ * hostname not found in dns cache *   trying 78.138.113.215... * adding handle: conn: 0x7fe1cb80a200 * adding handle: send: 0 * adding handle: recv: 0 * curl_addhandletopipeline: length: 1 * - conn 0 (0x7fe1cb80a200) send_pipe: 1, recv_pipe: 0 * connected marclab.de (78.138.113.215) port 80 (#0) > / http/1.1 > user-agent: curl/7.34.0 > host: marclab.de > accept: */* >  < http/1.1 302 found < date: fri, 27 jun 2014 09:29:44 gmt < content-type: text/html; charset=utf-8 < transfer-encoding: chunked < connection: keep-alive * server wsgiserver/0.1 python/2.7.4 not blacklisted < server: wsgiserver/0.1 python/2.7.4 < vary: accept-language, cookie < x-frame-options: sameorigin < location: http://marclab.de/ < content-language: en < set-cookie: django_language=en; expires=time.struct_time(tm_year=2015, tm_mon=6, tm_mday=27, tm_hour=11, tm_min=34, tm_sec=47, tm_wday=5, tm_yday=178, tm_isdst=0); max-age=31536000; path=/ <  * connection #0 host marclab.de left intact 

and trailing slash: (which looks same)

~ $ curl -v http://marclab.de/ * hostname not found in dns cache *   trying 78.138.113.215... * adding handle: conn: 0x7fa65b008200 * adding handle: send: 0 * adding handle: recv: 0 * curl_addhandletopipeline: length: 1 * - conn 0 (0x7fa65b008200) send_pipe: 1, recv_pipe: 0 * connected marclab.de (78.138.113.215) port 80 (#0) > / http/1.1 > user-agent: curl/7.34.0 > host: marclab.de > accept: */* >  < http/1.1 302 found < date: fri, 27 jun 2014 09:32:47 gmt < content-type: text/html; charset=utf-8 < transfer-encoding: chunked < connection: keep-alive * server wsgiserver/0.1 python/2.7.4 not blacklisted < server: wsgiserver/0.1 python/2.7.4 < vary: accept-language, cookie < x-frame-options: sameorigin < location: http://marclab.de/ < content-language: en < set-cookie: django_language=en; expires=time.struct_time(tm_year=2015, tm_mon=6, tm_mday=27, tm_hour=11, tm_min=37, tm_sec=50, tm_wday=5, tm_yday=178, tm_isdst=0); max-age=31536000; path=/ <  * connection #0 host marclab.de left intact 

my nginx config:

server {       listen       80;       server_name  marclab.de;        root         /dev/null;        try_files  $uri/index.html $uri.html $uri;        location / {         client_max_body_size 5m;         client_body_buffer_size 128k;         proxy_read_timeout 600;         proxy_set_header  x-real-ip        $remote_addr;         proxy_set_header  x-forwarded-for  $proxy_add_x_forwarded_for;         proxy_set_header  host             $http_host;         proxy_redirect    off;         proxy_pass        http://app01:3001/;       }       error_page   500 502 503 504  /50x.html; } 

thanks in advance!

i suppose, meant nginx config, not curl, right? way, seems implement redirection python application. can't give advise in case. can advise delegate job nginx. this:

server {   listen       80;   server_name  marclab.de;    root         /dev/null;    try_files  $uri/index.html $uri.html $uri;    location ~ ^/(.+)[^/]?/$ {     rewrite ^/(.+)[^/]?/$ $1/ permanent;   }    location / {     client_max_body_size 5m;     client_body_buffer_size 128k;     proxy_read_timeout 600;     proxy_set_header  x-real-ip        $remote_addr;     proxy_set_header  x-forwarded-for  $proxy_add_x_forwarded_for;     proxy_set_header  host             $http_host;     proxy_redirect    off;     proxy_pass        http://app01:3001/;   }   error_page   500 502 503 504  /50x.html; } 

please, try in testing environment before using on public. wrote memory , didn't test it.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -