-
Notifications
You must be signed in to change notification settings - Fork 373
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
HEAD requests are not using the provided request headers #592
Comments
Hey @frogleon |
Hi @bezoerb , thanks for you answer! I don't have one, unfortunately. However, let's take for example, this situation: There is an auth-only URL endpoint that accepts headers as part of the request and grabs the credentials from there; if the auth fails (missing/invalid credentials), there is a 301 redirect to the application's login page. In this case, the expectation would be that the specified headers are used for the request to succeed. What is happening is that this HEAD request exists in the code (see: src/file.js:795) and does not use the specified headers before the GET request. The final URL collected would be the login page, not the expected one. Therefore, it will create the wrong critical CSS content. I hope this helps clarify the issue. Edit: I'll add the code that I believe is causing this issue: try {
const response = await fetch(filepath, {options, request: {method: 'head'}}); // maybe the request field is overwriting entirely the options.request value, not only the "method" field?
if (response.url !== url) {
debug(`(vinylize) found redirect from ${url} to ${response.url}`);
url = response.url;
}
} catch {} Thank you again! |
I can second this issue - we set a custom userAgent for got that was only working half the time, and one of my team noticed all the requests with the default got user agent were all HEAD requests. GETs were all using the custom user agent. |
This is also occurring with Grunt. |
@bezoerb - it's working for me - thanks! |
Thanks! |
Request options passed as part of the initial "HEAD" request to verify if there is a redirect from the original provided URL are not the ones specified in the initial configuration. This could lead to discrepancies across GET and HEAD requests when specific headers are required (even as part of the HEAD request).
The text was updated successfully, but these errors were encountered: