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

"Downloader IP" in download history log: account for reverse-proxied requests #525

Conversation

blinkingtwelve
Copy link
Contributor

I've tried picoshare out today. Nice stuff!
I had stuck it behind a reverse proxy (Apache this time). But like this, in the download log (as under /files/$THE_ID/downloads) the "Downloader IP" of all downloads would list the IP of the proxy...

This PR will make it so that instead the client IP from the X-Forwarded-For header (which is, by convention, inserted by reverse HTTP proxies such as Apache and Nginx) is recorded.

Copy link

github-actions bot commented Jan 14, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@blinkingtwelve
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@mtlynch
Copy link
Owner

mtlynch commented Jan 14, 2024

Thanks for submitting this!

Are you seeing this behavior with PS_BEHIND_PROXY set to true?

https://github.com/mtlynch/picoshare#environment-variables

That should get you the correct IPs everywhere (e.g., in log files, error messages) rather than specifically in the download log.

@blinkingtwelve
Copy link
Contributor Author

That indeed does the job. I hadn't read the README past all the Docker blah ;-)

Please close!

@github-actions github-actions bot locked and limited conversation to collaborators Jan 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants