Welcome! Log In Create A New Profile

Advanced

[PATCH] fixed an "IfIsEvil" example that ngx_proxy did not inherit plcf->location

agentzh
June 24, 2012 01:12AM
Hello!

The standard ngx_proxy module does not inherit the location config's
"location" field for the "location if" block in
ngx_http_proxy_merge_loc_conf, making the following config example
fail mentioned on the "IfIsEvil" page:

# request will be sent to backend without uri changed
# to '/' due to if

location /proxy-pass-uri {
proxy_pass http://127.0.0.1:8080/;

set $true 1;
if ($true) {
# nothing
}
}

Below is a patch for nginx 1.2.1 that attempts to fix this issue.
Comments welcome!

Thanks!
-agentzh

--- nginx-1.2.1/src/http/modules/ngx_http_proxy_module.c 2012-04-23
18:40:01.000000000 +0800
+++ nginx-1.2.1-patched/src/http/modules/ngx_http_proxy_module.c 2012-06-24
12:48:57.289834450 +0800
@@ -3023,8 +3023,10 @@

if (conf->upstream.upstream || conf->proxy_lengths) {
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
- if (clcf->handler == NULL && clcf->lmt_excpt) {
- clcf->handler = ngx_http_proxy_handler;
+ if (clcf->handler == NULL) {
+ if (clcf->lmt_excpt) {
+ clcf->handler = ngx_http_proxy_handler;
+ }
conf->location = prev->location;
}
}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] fixed an "IfIsEvil" example that ngx_proxy did not inherit plcf->location Attachments

agentzh 1201 June 24, 2012 01:12AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 311
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