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

How to use ProxyFix with klein? #723

Open
laf0rge opened this issue Jan 30, 2024 · 1 comment
Open

How to use ProxyFix with klein? #723

laf0rge opened this issue Jan 30, 2024 · 1 comment

Comments

@laf0rge
Copy link

laf0rge commented Jan 30, 2024

I'm running a klein based app behind a [nginx] reverse proxy which sets the various X-Real-IP, X-Forwarded-* headers. Klein doesn't automaticall seem to pick up on those, as the client IP logged is always the IP of the reverse proxy.

I saw there is https://werkzeug.palletsprojects.com/en/2.3.x/middleware/proxy_fix/ available for werkzeug, but I was unable to figure out how to use it. if I say something like

app = ProxyFix(my_klein_app, x_for=1, x_host=1)
app.run()

then the proxyFix of course doesn't offer the same run method like Klein.

@glyph
Copy link
Member

glyph commented Jan 30, 2024

Twisted should really provide this sort of functionality for Klein, given that we aren't running via WSGI.

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