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

CORS header user-agent in Firefox in 1.0.0-beta.35 #1803

Closed
blacktemplar opened this issue Jul 27, 2018 · 9 comments
Closed

CORS header user-agent in Firefox in 1.0.0-beta.35 #1803

blacktemplar opened this issue Jul 27, 2018 · 9 comments
Assignees
Labels
Bug Addressing a bug
Projects

Comments

@blacktemplar
Copy link

I am using the new version 1.0.0-beta.35 and I am connecting to a public https provider. Everything works fine in google chrome but when I try it in Firefox he sends Options requests to the public provider which include the following header:

Access-Control-Request-Headers:content-type,user-agent

Google chrome also sends such a header but without user-agent (only content-type). Since I get CORS error on Firefox I googled the problem and it seems quite strange that user-agent gets sent here in Firefox. If I resend the request withouth user-agent it goes through.

In the Firefox console I also see the following Warning:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at XXX. (Reason: missing token ‘user-agent’ in CORS header ‘Access-Control-Allow-Headers’ from CORS preflight channel).

blacktemplar added a commit to blacktemplar/augur-fee-windows-info that referenced this issue Jul 31, 2018
@pierreneter
Copy link
Contributor

It's not an issue of web3, it's issueabout your config and config of this https provider about header of the HTTP protocol.

@blacktemplar
Copy link
Author

I understand that if the provider sends the right CORS this is not an issue, but still the user-agent field in the Access-Control-Allow-Headers is not really common.

The weird thing is if I use the dist/web3.min.js instead of the npm module it doesn't send this header and it works. So I think the problem lies somewhere in how to package your npm module with webpack (which is what I use to package the browser application).

@pierreneter
Copy link
Contributor

pierreneter commented Aug 7, 2018

Hey, this's issue!! It makes broken any app of me when I update web3 to .35.

using minified web3 file instead of npm module to temporarily fix bug

It do not fixes this bug, because current minified web3 still .34.

@pierreneter
Copy link
Contributor

you are using minified web3 of version .34

@dinostabOMG
Copy link

but still the user-agent field in the Access-Control-Allow-Headers is not really common.

@blacktemplar We're seeing this in requests from Firefox, so it seems like any server application that doesn't include this header would not pass the preflight requests from Firefox? Is that really such a common situation?

@edwardfxiao
Copy link

downgrade to v1.0.0-beta.33 solved my problem

markspanbroek added a commit to Charterhouse/truffle-create-react-app that referenced this issue Aug 28, 2018
This issue causes a CORS error on both Firefox and Safari.
@nivida nivida added this to To do in 1.0 Nov 28, 2018
@d10r
Copy link

d10r commented Dec 28, 2018

Same issue in beta.37.
Is there a known workaround besides downgrading web3 (I have access to the RPC server config)?

PS: may this also be the reason for websocket web3 connections not working in Firefox? I don't get the CORS error messages then, but the request returns 403 (in Chrome it succeeds) and there's headers related to the origin.

@nanexcool
Copy link
Contributor

nanexcool commented Mar 6, 2019

@nivida any updates on this issue? Seems it's making Brave/Firefox not work with HTTPProvider

I just tried with latest web3 1.0.0-beta.48

@nivida
Copy link
Contributor

nivida commented Mar 25, 2019

Just checked this issue closer and it is a issue of infura. They will fix it with sending of the correct headers. INFURA/infura#174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
No open projects
1.0
  
Done
Development

No branches or pull requests

7 participants