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
Always send a referrer-policy header #15673
Conversation
@@ -287,6 +287,9 @@ public function render() | |||
// don't send Referer-Header for outgoing links | |||
if (!empty($this->useStrictReferrerPolicy)) { | |||
Common::sendHeader('Referrer-Policy: same-origin'); | |||
} else { | |||
// always send explicit default header | |||
Common::sendHeader('Referrer-Policy: no-referrer-when-downgrade'); |
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.
@Findus23 do you have maybe some thoughts on this?
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.
no-referrer-when-downgrade
is the default when no header is sent, so sending it when we normally wouldn't send anything shouldn't change anything.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
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.
thanks @Findus23 be good if someone could still test the PR and have a look at tests. Not sure if I find time today.
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.
Aye it's the (implicit) default; this PR caters to our setup where we set a strict policy if nothing is explicitly set by the application (see this comment). Just in case you want to cater for our way of thinking (not sure if we're the outlier here or if more people might want to set their policies with setifempty
).
Tests look fine and matomo seems to work fine locally for me, will merge. |
Suggested fix / improvement for #14764