Skip to content

Instantly share code, notes, and snippets.

@ftischhauser
Last active May 12, 2017 18:29
Show Gist options
  • Save ftischhauser/4e9ab11a8cc80f40ed2e to your computer and use it in GitHub Desktop.
Save ftischhauser/4e9ab11a8cc80f40ed2e to your computer and use it in GitHub Desktop.
Nginx as a blackhole server for PAC based ad blockers
server {
# Listen on port 9123. Change to your liking and remove 'deferred' if unsupported on your OS.
listen [::]:9123 ipv6only=off deferred;
# We don't need to log these proxy requests.
access_log off;
# Let browsers cache our responses.
expires max;
location / {
# Return an empty gif for all requests.
empty_gif;
}
}
@ftischhauser
Copy link
Author

Safari on iOS 8 now shows the "Open in..." dialog for empty responses, so it's safer to just output empty_gif for all requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment