Skip to content

Conversation

@rlaiola
Copy link
Contributor

@rlaiola rlaiola commented Oct 6, 2023

Reference Issues

The proposed approach addresses the issue reported at #38.

What does this implement/fix?

This pull request includes a code fix to get the real IP of the user when running BOCA with a reverse proxy. If REMOTE_ADDR belongs to a list of trusted proxies (BOCA_TRUSTED_PROXIES env var), then BOCA should consider that the real user IP is in HTTP_X_FORWARDED_FOR.

How to test it?

git clone --branch test_fix_getip_proxy https://github.com/rlaiola/boca.git
cd boca
# Launch application (it may take a while)
BOCA_TRUSTED_PROXIES=192.168.0.100 docker compose up -d
# Open a web browser and visit the URL http://localhost/boca.
# First, create and activate a BOCA contest (user: system | password: boca).
# Then, login as admin (user: admin | password: boca).
# Visit the users' page to see that the admin IP is NOT 192.168.0.100 (the proxy IP)
# To stop the application:
docker compose down

Other Comments

Feel free to suggest other approaches to address the problem.

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

Successfully merging this pull request may close these issues.

1 participant