Skip to content
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

GM_xmlhttpRequest cannot set HTTP referer header #1240

Closed
u-nn opened this issue Dec 14, 2010 · 2 comments
Closed

GM_xmlhttpRequest cannot set HTTP referer header #1240

u-nn opened this issue Dec 14, 2010 · 2 comments
Milestone

Comments

@u-nn
Copy link
Contributor

u-nn commented Dec 14, 2010

Trying to set the "Referer" HTTP header in a GM_xmlhttpRequest causes the header to be silently ignored, and no referer is sent. I believe this is deliberately done in firefox, so if this is a bug at all, it's a firefox bug and not a gm bug. However, this can be worked around in gm by setting the referer from an http-on-modify-request observer instead of directly in the XHR request.

Commit u-nn/greasemonkey@c6a2897 shows an implementation of this workaround, which seems to work for me. I'm not sure how ugly or undesirable that approach is, but I would really like to be able to set referers (this is kinda required for automating form submissions cross-domain). If it's not desired without special consideration, this could also be enabled by setting some certain GM_XHR 'details' field to turn it on, instead of just always doing this when 'Referer' is encountered in the set headers.

Googling this issue brings up some discussion elsewhere, but I don't see an issue here, and I haven't seen anyone bring up the idea of using the observer workaround in GM yet.

@arantius
Copy link
Collaborator

Confirmed, test case: https://gist.github.com/919968

Should expect its output to contain the referer header, today it does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants