How does nginx reverse proxy a relative url?
大家讲道理
大家讲道理 2017-05-16 17:15:51
0
1
496
server {
    listen       80;
    server_name  www.hehehe.com;

    charset utf-8;
    
    location /test {
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:3031;
    }
}

For requests like this at http://hehehe.com/test/index
The reverse proxy reaches uwsgi, which is a django application

Then I just want to proxy the url response of the /index part, not /test/index

Now/test/index causes my django url route to fail to match.

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
Ty80
server {
    listen 80 default_server;
    client_max_body_size   10M;
    client_body_buffer_size   128k;

    server_name $host;

    index index.html;
    root /website/$host;
    location / {
    }
    location ~ /dev/ {
        rewrite /dev/(.*)$ / break;
        proxy_pass http://localhost:3000;
    }
}

Rewrite it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template