Consider this configuration fragment:
log_format test_log ‘TEST: [$origin_ip] [$upstream_http_content_type]’;
location / {
access_log /tmp/test.log test_log;
set $origin_ip $upstream_http_content_type;
proxy_pass http://127.0.0.1:6060;
}
Why am I seeing this in the log file “test.log”?
TEST: []
Why is set not being loaded with $upstream_http_content_type? Shouldn’t
I see:
TEST:
Any ideas?
Posted at Nginx Forum:
If this is expected behavior how to I go about passing information when
an internal redirect is involved between two different locations.
For example:
Location /u1 {
set $remember $upstream_http_content_type;
proxy_pass http://127.0.0.1:6060;
error_page 404 403 = @error;
}
Location @error {
# recall $remember here, perhaps for logging.
}
Posted at Nginx Forum:
Hello!
On Sun, Nov 29, 2009 at 03:16:26AM -0500, icqheretic wrote:
}
Directive “set” executes at rewrite phase, before proxy even
starts working. As a result $origin_ip will be empty.
Maxim D.
Thanks, Max. If that’s the case then calling set in the @error location
a lo tof sense. However, $remember, is still coming back blank –
perphaps someting to do with the error_page directive?
Any ideas or alternatives for remembering the header information (to be
recalled in @error) would be much appreciated. Thanks!
Posted at Nginx Forum:
Hello!
On Sun, Nov 29, 2009 at 03:19:10AM -0500, icqheretic wrote:
If this is expected behavior how to I go about passing information when an internal redirect is involved between two different locations.
For example:
Location /u1 {
set $remember $upstream_http_content_type;
proxy_pass http://127.0.0.1:6060;
error_page 404 403 = @error;
}
Location @error {
# recall $remember here, perhaps for logging.
}
Maxim D.
I was wrong, it DOES work. It helps to edit the right config file
sometimes.
Sorry, Max.
Posted at Nginx Forum: