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

$upstream_addr not set #217

Open
bigboyq opened this issue Mar 7, 2022 · 3 comments
Open

$upstream_addr not set #217

bigboyq opened this issue Mar 7, 2022 · 3 comments

Comments

@bigboyq
Copy link

bigboyq commented Mar 7, 2022

0. Before Your ASK

  1. Try to find an answer by reading a FAQ.

Ⅰ. Issue Description

log_format main '$proxy_protocol_addr $bytes_sent $request_length [$time_local] "$request" "$upstream_addr"'
'$status "$http_referer" "$http_user_agent"' ;

Ⅱ. Describe what happened

In log file, Upstream_addr expected to be real upstream ip address

Ⅲ. Describe what you expected to happen

In log file, Upstream_addr was set as -.

Ⅳ. How to reproduce it (as minimally and precisely as possible)

Ⅴ. Anything else we need to know?

  1. If applicable, add nginx debug log.

Ⅵ. Environment:

  1. Tengine/Nginx/OpenResty version (use sbin/nginx -v):
  2. Which patch do you use?
@chobits
Copy link
Owner

chobits commented Mar 26, 2022

Maybe it failed before running 'connecting upstream' phase, you can post the whole log message here to let us check.

@bigboyq
Copy link
Author

bigboyq commented Mar 27, 2022

I used $connect_addr instead, but I think $upstream_addr should be reused in connect module too

http {
log_format main '$proxy_protocol_addr $bytes_sent $request_length [$time_local] "$request" "$connect_addr"'
		    '$status "$http_referer" "$http_user_agent"' ;
server{
}

@bigboyq
Copy link
Author

bigboyq commented Mar 27, 2022

BTW, I wish to log proxy_connect_bind, as I have multi wan, I want to log every outing connections and bind_address
I tried $proxy_connect_bind, but I got

nginx: [emerg] unknown "proxy_connect_bind" variable
nginx: configuration file /etc/nginx/nginx.conf test failed

Any ideas?

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