-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
use fully-resolved URI with custom scheme for HTTP Referer header, or a different header name entirely #930
Comments
More on this... shouldn't the Referer of a tarball be the packument URL if we fetched that first? Or Definitely best to just omit it. |
Re: npm/cli#930 BREAKING CHANGE: Removes the 'opts.refer' option and the HTTP Referer header (unless explicitly added to the 'headers' option, of course).
Re: npm/cli#930 BREAKING CHANGE: Removes the 'opts.refer' option and the HTTP Referer header (unless explicitly added to the 'headers' option, of course). PR-URL: #25 Credit: @isaacs Close: #25 Reviewed-by: @mikemimik
This will be fixed as we move deps to the new versions of npm-registry-fetch and libraries using it. I don't think we have to track this separately. |
Background
The fact that the npm client sends a
referer
header with a redacted copy of the npm command is cute, and not exactly a violation of the HTTP specification, but a weird use of it, which has caused some recent disruptions and pushback.The reason for choosing Referer in the first place is that it is very reliably left intact by proxies. And, semantically, the resource represented by the command sent to npm is the "thing" that triggered the request. However:
npm-session
and a fewpacote
headers, and rely on them in our registry data analysis. Some of them undoubtably get dropped by over eager proxies more frequently than Referer would, but it's fine.Referer: install
, so it doesn't actually provide much value in practice in aggregate. However, it can provide some insight in certain debugging scenarios, so it's not completely without merit.Proposed Change
referer
header from all npm CLI requests.npm-command
header to registry requests, with the current value of theReferer
header.Alternatively, don't send an
npm-command
header, since it's alwaysinstall
anyway. (And when it isn't, there's usually a way to infer what's going on from the HTTP verb and route.)Example
No user-facing changes, except that
referer:
in a typical npm request will be replaced withnpm-command:
.How
Current Behaviour
npm sends a
referer:
header.Desired Behaviour
npm does not send a
referer:
header.Implementation
referer
header is explicitly supplied in theheaders
option tomake-fetch-happen
, do not send a referer header.--refer
config flag in the cli where it calculates and redacts based on the argv.refer
field innpm.flatOptions
.The text was updated successfully, but these errors were encountered: