Verify ublproxy ad-blocking behavior by comparing responses with and without the proxy using curl. Use when the user asks to test, verify, or compare proxy behavior against a website.
Test ublproxy's ad-blocking (request blocking and element hiding CSS injection) by comparing curl responses with and without the proxy.
The proxy must be running with a blocklist:
# Start the proxy with adblock rules
mise run dev -- --blocklist examples/is.rules
Before testing, check what rules the blocklist has for the target domain:
# Element hiding rules (##)
grep "example.is##" examples/is.rules
# URL blocking rules (||)
grep "||.*example" examples/is.rules
# Global element hiding rules (apply to all domains)
grep "^##" examples/is.rules
Blocked hostnames return 403 for HTTPS (CONNECT) requests:
curl -v --proxy https://127.0.0.1:8443 --proxy-insecure -k https://blocked-domain.com 2>&1 | grep "< HTTP"
# Expected: HTTP/1.1 403 Forbidden
Element hiding injects display: none !important CSS rules into HTML responses. Check for the injected style tag:
curl -s --proxy https://127.0.0.1:8443 --proxy-insecure -k https://example.is | grep 'display: none'
Save responses and diff them to see exactly what the proxy changed:
curl -s --proxy https://127.0.0.1:8443 --proxy-insecure -k https://example.is > tmp/with-proxy.html
curl -s https://example.is --compressed > tmp/without-proxy.html
diff tmp/without-proxy.html tmp/with-proxy.html
# Terminal 1: start proxy
mise run dev -- --blocklist examples/is.rules
# Terminal 2: check what rules apply
grep "1819.is" examples/is.rules
# Compare responses
curl -s --proxy https://127.0.0.1:8443 --proxy-insecure -k https://1819.is > tmp/with-proxy.html
curl -s https://1819.is --compressed > tmp/without-proxy.html
# Check for element hiding CSS injection
grep 'display: none' tmp/with-proxy.html
# Diff to see all changes
diff tmp/without-proxy.html tmp/with-proxy.html
mise run dev -- --blocklist examples/is.rulescurl --proxy https://127.0.0.1:8443 --proxy-insecure -k https://example.comContent-Encoding with curl -D-.