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

Proxy serves different REMOTE_ADDR for visitors, need to checkout for X-Forwarded-For when applicable. #63

Open
ninasarabia opened this issue Mar 9, 2018 · 0 comments
Assignees

Comments

@ninasarabia
Copy link
Collaborator

ninasarabia commented Mar 9, 2018

When using HAProxy, the server var REMOTE_ADDR outputs as the DO droplet IP so IPs cannot be whitelisted on HAProxy enabled droplets. The apache definition done for htpasswd would need to check X-Forwarded-For for the correct visitor IP.

Below was a revision that worked for me (with ${WHITELIST_IP} hardcoded during my testing). From what I can see, you're doing some sed replacement in TUGBOAT-php, so that would need to be accounted for here.

Order deny,allow
Deny from all
SetEnvIF X-Forwarded-For "${WHITELIST_IP}" AllowIP
<RequireAny>
        Require env AllowIP
</RequireAny>
AllowOverride All
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
Allow from env=AllowIP
Allow from ${WHITELIST_IP}
Satisfy Any
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants