lots of work in a location block...

Steve Holdoway steve at greengecko.co.nz
Wed Jun 18 00:15:29 UTC 2014


Hi Folks,

I'm trying to integrate a python backend into a pre-existing php
website, and am having problems doing this as I need to rewrite the url
at the same time... eg: this is what isn't working.

	location = /example {
		rewrite /example/(.*) /$1 break;

		root /www/example;
		
		include proxy_params;
		proxy_pass http://python;

		#break;
	}
( stripped to bare essentials )

So it's
 - strip off the /example prefix
 - set the new root ( the php site sets is outside any location block )
 - pass stripped request to the python backend.

I've tried every option I can think of, but they all seem to drop out of
the location block and process the rewritten request again, which means
that they're not using the static files in the locally defined root, and
also aren't being handed to the python backend for processing.

I've fudged it for the moment, but would really like to do it properly! 

Cheers,

Steve.

Oh, proxy_params contains

proxy_next_upstream error timeout invalid_header http_500 http_502
http_503 http_504;
proxy_redirect off;
proxy_buffering off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;




-- 
Steve Holdoway BSc(Hons) MIITP
http://www.greengecko.co.nz
Linkedin: http://www.linkedin.com/in/steveholdoway
Skype: sholdowa



More information about the nginx mailing list