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

Add mod_remoteip to all Apache installs #19

Open
preaction opened this issue Oct 11, 2017 · 0 comments
Open

Add mod_remoteip to all Apache installs #19

preaction opened this issue Oct 11, 2017 · 0 comments

Comments

@preaction
Copy link
Member

Most of our sites are behind Fastly CDN cache, which means that most of our sites' access logs show Fastly's IP address, not the real address of the user who is using our site. If we want to then block access to people abusing our site, we need to know their real IP address.

Apache has a module that will show us their IP address: mod_remoteip. In order for this to work, we need to set up some configuration (in the file /etc/apache2/mods-available/remoteip.conf):

RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxyList /etc/apache2/proxy.list

We also need a cron job to update the /etc/apache2/proxy.list file with this command:

curl -s https://api.fastly.com/public-ip-list | jq -r '.addresses | .[]' > /etc/apache2/proxy.list

Once these two things are in place, we can enable the module using a2enmod remoteip.

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

1 participant