﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
1246	proxy_pass does not form correct URI when declared with $scheme variable	Sergei Kudimov		"proxy_pass does not form correct URI when declared with $scheme variable:

{{{
server {
    listen 80;
    listen 443 ssl http2;

    server_name frontend.com;

    include conf.d/ssl.conf;

    location / {
        proxy_pass              $scheme://127.0.0.1/hu/;
        # proxy_pass              http://127.0.0.1/hu/;
        proxy_set_header        Host    backend.com;
        include conf.d/proxy-params.conf;
    }
}
}}}

Test request from x.x.x.x host:
{{{curl http://frontend.com/css/style.css}}}

Server logs following lines:
{{{
backend.com 127.0.0.1 - - [12/Apr/2017...] ""GET /hu/ HTTP/1.0"" 200 13995 ""-"" ""curl/7.35.0"" ""-""
frontend.com x.x.x.x - - [12/Apr/2017...] ""GET /css/style.css HTTP/1.1"" 200 14023 ""-"" ""curl/7.35.0"" ""-""
}}}

As we see request for /css/style.css was proxied as /hu/, which is incorrect. According to documentation expected form is /hu/css/style.css.

When I have replaced {{{$scheme://}}} with explicit {{{http://}}} it began to work properly:
{{{
backend.com 127.0.0.1 - - [12/Apr/2017...] ""GET /hu/css/style.css HTTP/1.0"" 404 328 ""-"" ""curl/7.35.0"" ""-""
frontend.com x.x.x.x - - [12/Apr/2017...] ""GET /css/style.css HTTP/1.1"" 404 356 ""-"" ""curl/7.35.0"" ""-""
}}}
"	defect	closed	major		nginx-core	1.11.x	invalid			Linux vps 3.19.0-26-generic #28~14.04.1-Ubuntu SMP Wed Aug 12 14:09:17 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux	nginx version: nginx/1.11.9
