Welcome! Log In Create A New Profile

Advanced

Request path not passed to proxy when $scheme is used in proxy_pass URI

Ben Hoskings
March 23, 2013 11:58PM
Hi all, I've found a strange behaviour with proxy_pass. I've reduced a
simple vhost that reproduces it:

server {
listen 127.0.0.1:8000;
location / {
proxy_pass $scheme://127.0.0.1:9000/;
}
}

A listener on localhost:9000 receives a request, but for '/' instead of the
correct path. For example, curling this URI...
> curl -I -X GET http://localhost:8000/test-path

.... causes a "GET /" on a local listener:
> nc -l 127.0.0.1 9000
GET / HTTP/1.0

If I replace $scheme with 'http' (i.e. "proxy_pass http://127.0.0.1:9000/"),
then it works correctly:
> curl -I -X GET http://localhost:8000/test-path

> nc -l 127.0.0.1 9000
GET /test-path HTTP/1.0

I ran these tests on nginx-1.2.7 / OS X 10.8.3; the behaviour is the same
on nginx-1.2.4 / Ubuntu 12.04 (which is where I discovered it).

Am I using $scheme incorrectly here, or could this be a bug?

Cheers,
Ben Hoskings
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Request path not passed to proxy when $scheme is used in proxy_pass URI

Ben Hoskings March 23, 2013 11:58PM

Re: Request path not passed to proxy when $scheme is used in proxy_pass URI

Ben Hoskings March 24, 2013 06:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 241
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready