On Jul 9, 2008, at 11:56 AM, Shannon -jj Behrens wrote:
The trick is configuring Nginx with: proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; Once you do this, you don't even need to use Paste's proxy middleware. Nginx itself will setup the Host header correctly.
Actually, you sort of still need to use PasteDeploy's PrefixMiddleware. Especially the version that I think is only in the latest code under the following condition:
* You have a site that is proxied to under http AND httpsThis is because the wsgi.url_scheme will get set to http by default, so generating absolute URL's under the https side will result in non- https URL's. The latest trunk of PasteDeploy's PrefixMiddleware will look for another Header, X_FORWARDED_PROTO. So my setup for nginx looks like this (for the HTTPS proxy location):
proxy_set_header Host $host; proxy_set_header X_FORWARDED_PROTO https;And I have PrefixMiddleware in my config/middleware.py. PrefixMiddleware will then properly setup the wsgi.url_scheme which ensures that everything makes appropriate URL's for where it is.
Cheers, Ben
smime.p7s
Description: S/MIME cryptographic signature