No description
- Go 100%
Stripping the cmp.iife script tag left window.payOrConsentCMP undefined; the app calls .init()/.doWeHaveConsent() unconditionally during hydration, so it threw and Svelte blanked the page (and the components re-inject the tag anyway). Instead inject a no-op payOrConsentCMP stub in <head> that never grants consent (keeps ads/tracking/paywall dormant), and serve the cmp.iife/intowow assets empty so the real CMP can't overwrite it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .gitignore | ||
| .woodpecker.yaml | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
| proxy.go | ||
| README.md | ||
| rewrite.go | ||
| rewrite_test.go | ||
feltetproxy
A small reverse proxy for feltet.dk that keeps your browser completely cookie-free:
- All upstream cookies live in a proxy-side jar (
net/http/cookiejar). EverySet-Cookieheader is stripped before responses reach the browser, and browserCookieheaders are never forwarded upstream. - The Cookiebot consent banner never renders — the first-party CMP bundle
(
cmp.iife.<hash>.js) and the intowow ad-injection script are stripped from HTML. feltet.dk serves full content without consent, so nothing is lost. - Ad/tracker URLs are neutered: references to doubleclick.net,
googletagmanager.com, google-analytics.com, googlesyndication.com,
cookiebot.com, admanager/tag-matcher (ekstrabladet.services) and lwgadm.com
are rewritten to the proxy's
/blockedsink, which answers204 No Content. - Navigation stays on the proxy:
https://(www.)feltet.dkURLs in HTML, JS, JSON and CSS (including\/-escaped JSON forms) are rewritten to the proxy origin. - Allow-listed third parties (JW Player video, feltet's own asset/API
hosts) are fetched through
/ext/<host>/..., cookie-stripped like everything else. Any other host gets403.
Run
go build -o feltetproxy .
./feltetproxy # listens on 127.0.0.1:8080
./feltetproxy -listen 127.0.0.1:8888
Then browse http://localhost:8080.
Adding allow-listed hosts
Exact hosts go in extAllowed, whole CDN domains with variable subdomains in
extAllowedSuffixes (both in proxy.go). Suffix-allowed domains also need a
matching entry in extSuffixRe (rewrite.go) so URLs in response bodies and
Location headers get rewritten to /ext/<host>/.
Notes
- The jar is in-memory: cookies vanish on restart. That includes any login session — log in again after restarting the proxy.
- CSP/HSTS headers are stripped so rewritten pages work over plain http from localhost. Don't expose the listener beyond localhost.
- If your local DNS blocklists a media CDN (e.g.
*.jwpsrv.com→::), those assets 502 through the proxy too — that's the blocklist, not the proxy.
Tests
go test ./...