Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nginx] uninitialized "proxy_upstream_name" variable while logging request #711

Closed
cheungpat opened this issue May 14, 2017 · 0 comments
Closed

Comments

@cheungpat
Copy link
Contributor

It appears that when there is a 301 Redirect, nginx prints this log:

2017/05/14 00:03:53 [warn] 8590#8590: *560 using uninitialized "proxy_upstream_name" variable while logging request, client: 1.2.3.4, server: www.example.com, request: "GET / HTTP/1.1", host: "www.example.com"

Tested it with curl:

$ curl -v http://www.example.com
...
< HTTP/1.1 301 Moved Permanently
< Server: nginx/1.11.12
< Date: Sun, 14 May 2017 00:10:59 GMT
< Content-Type: text/html
< Content-Length: 186
< Connection: keep-alive
< Location: https://www.example.com/

I suspect that when nginx got a http request, it tries to redirect before the $proxy_upstream_name variable is set. The generated nginx config seems to confirm so:

        # enforce ssl on server side
        if ($pass_access_scheme = http) {
            return 301 https://$best_http_host$request_uri;
        }
        location / {
            set $proxy_upstream_name "www-www-5000";
cheungpat added a commit to cheungpat/ingress-nginx that referenced this issue May 14, 2017
When nginx performs ssl redirect, $proxy_upstream_name used in log
is not initialized because it is set after nginx matched a location directive,
which is not the case when performing a ssl redirect.

refs kubernetes#711
@aledbf aledbf closed this as completed May 14, 2017
ankon pushed a commit to Collaborne/ingress that referenced this issue Jun 27, 2017
When nginx performs ssl redirect, $proxy_upstream_name used in log
is not initialized because it is set after nginx matched a location directive,
which is not the case when performing a ssl redirect.

refs kubernetes#711

(Cherry-picked from a83f17c and adjusted to keep the settings in logical order)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants