Reverse Proxy Worker forwarding requests to Zero Trust backend causing a 302 redirection loop.

My reverse proxy worker seems to be dropping the CF-Auth tokens from Zero trust when forwarding with the only code being return fetch(event.request). Any ideas to help solve this issue?
6 Replies
Cyb3r-Jak3
Cyb3r-Jak314mo ago
What does your code look like?
AKStriker98
AKStriker98OP14mo ago
addEventListener(“fetch” (event) => { event.respondWith(fetch(event.request)) }) Should snote, that I suspect it’s the auth cookies getting lost with the fetch call because I can see them come in on event.request, but with Zero Trust active it’s causing a 302 redirection loop tying to authenticate
Cyb3r-Jak3
Cyb3r-Jak314mo ago
Access runs in front of workers so your code will never reach the worker if it isn't authenticated
AKStriker98
AKStriker98OP14mo ago
It’s authenticated when the request hits the worker. We suspect that the fetch is dropping the cookies to the backend since it sends 302s as a response The loop we’re seeing is, even with a valid cloudflare access token in the browser: User -> worker -> example.com -302-> cloudflare access.com -302 -> worker -> example.com
Cyb3r-Jak3
Cyb3r-Jak314mo ago
Ah unfortunately never used access with workers so hopefully someone else knows more
AKStriker98
AKStriker98OP14mo ago
Darn. Yeah. The reverse proxy bit works just fine without access and the access works just fine without there worker. So there’s some conflict going on Seeing if anyone else has worked with a reverse proxy worker behind zero trust before
Want results from more Discord servers?
Add your server