开发者

NGINX passing requests to Pylons and relative URLs

I have NGINX running on port 8080. I have the following setup in my NGINX conf file.

server {
    listen       8080;
    server_name  d开发者_开发问答omain.com;

location / {
        #root   /usr/share/nginx/html;
        #index  index.html index.htm;
        proxy_pass http://127.0.0.1:80;
        proxy_redirect http://127.0.0.1:80  http://domain.com;
    }

These rules work correctly as far as I can tell. The only issue I run into is when Pylons gets a request for a relative URL it is using http://127.0.0.1/linkto/something instead of http://domain.com:8080/linkto/something. I believe I am missing something in my Pylons configuration, if you have any advice or need additional information just let me know. Thanks in advance for any assistance on this.


By default, proxy_pass uses the hostname from the directive (127.0.0.1 in your case) as the Host: header for its request. You probably just need to add proxy_set_header Host $http_host; to have it pass through the original Host header to your backend.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜