Add nginx reverse proxy for Plausible analytics and security filtering#2595
Open
mroderick wants to merge 1 commit intocodebar:masterfrom
Open
Add nginx reverse proxy for Plausible analytics and security filtering#2595mroderick wants to merge 1 commit intocodebar:masterfrom
mroderick wants to merge 1 commit intocodebar:masterfrom
Conversation
- Add nginx configuration with Plausible proxy routes and security filters - Configure Puma to bind to Unix socket with restricted permissions - Update Procfile to use bin/start-nginx wrapper - Update Plausible snippet to use proxied endpoints (/js/script.js, /api/event) Security features: - Block malicious user agents (Nikto, sqlmap, etc.) with HTTP 444 - Block common attack paths (WP admin, .env, .git, etc.) - Add security headers: X-Frame-Options, X-Content-Type-Options, X-XSS-Protection, Referrer-Policy - Set proxy timeouts and request size limits
50f96fa to
ae07616
Compare
till
reviewed
Apr 25, 2026
| @@ -0,0 +1,84 @@ | |||
| daemon off; | |||
Collaborator
There was a problem hiding this comment.
Why doesn't this config use proxy_cache etc. as outlined in the docs?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the proposal from #2580 to run nginx as a reverse proxy in front of Rails on Heroku. This achieves two primary goals:
Changes
Infrastructure
heroku-community/nginxbuildpack configuration (config/nginx.conf.erb)Procfileto usebin/start-nginxwrapperconfig/puma.rb)Analytics
/js/script.js,/api/event)Security
Security Review
This implementation has been reviewed against OWASP Top 10 (2021):
Deployment
Required (one-time):
Deployment:
Testing Checklist
Plausible Proxy:
/js/script.jsreturns Plausible script with correct content-type/api/eventaccepts POST and forwards to PlausibleSecurity Filters:
curl -A "Nikto" https://staging/returns 444 (no response)curl https://staging/.envreturns 444curl https://staging/wp-adminreturns 444Rails Functionality:
Rollback
If issues arise:
References