-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add referer on redirect #68
base: main
Are you sure you want to change the base?
Conversation
0f7d447
to
100d80e
Compare
Deploying with Cloudflare Pages
|
const headers = new Headers(request.headers) | ||
headers.set('Referrer-Policy', 'unsafe-url') | ||
headers.set('Location', url.toString()) | ||
headers.set('Referer', request.headers.get('Referer')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work IRL? I thought this was one of those headers you're not allowed to set in a browser/worker context!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this what we send back to the client right? Referer
is a request header, I'm not sure I understand how this fixes the issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix is based on discussion https://community.cloudflare.com/t/passing-on-referer-value-on-301-https-redirects/78787/8
The goal is to have CF analytics / Firewall have access to the Referer, which looks like not the case with current redirect.
Does this work IRL?
I need to deploy to see, using staging dedicated route it does not break anything, but for actually seeing analytics in nftstorage.link domain I need to get it there
On redirect we are dropping referer, let's keep it