Problem with cors after the last release 1.0.4
See original GitHub issuegolang app
func allowCors(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "http://localhost:3000")
w.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
w.Header().Set("Access-Control-Expose-Headers", "grpc-status, grpc-message")
w.Header().Set("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, XMLHttpRequest, x-user-agent, x-grpc-web, grpc-status, grpc-message")
}
the problem only happens with chrome… the version that I’m using is Version 73.0.3683.75 (Official Build) (64-bit)
It seems this new release sends this two extra headers "grpc-status, grpc-message"
even though I have this specified in my golang above, this is still throwing this errors in my react app
Issue Analytics
- State:
- Created 4 years ago
- Comments:11
Top Results From Across the Web
Issue in Enabling CORS for Web API 1, .net 4.0 - Stack Overflow
I found this simple solution by charanjit singh. It worked nicely especially if you are stuck with older visual studio 2010 , on...
Read more >3 Ways to Fix the CORS Error — and How the Access-Control ...
Fix one: install the Allow-Control-Allow-Origin plugin. The quickest fix you can make is to install the moesif CORS extension .
Read more >Microsoft.AspNetCore.Mvc.Cors 1.0.4 - NuGet
This package has at least one vulnerability with high severity. It may lead to specific problems in your project. Try updating the package...
Read more >CORS error with Jira REST API on Cloud - Atlassian Community
For further explanation: The problem why we don't support CORS directly on your site host/domain is that we accept session based authentication on...
Read more >Enabling Cross Origin Requests for a RESTful Web Service
The browser will fail the request if the CORS headers are missing from the response. To test the CORS behaviour, you need to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@BirknerAlex instead of wrapping the grpc server with http you can use tcp and connect to it using a proxy, for instance here is an example with envoy-proxy… it will solve the problem and I think would be a better solution
https://github.com/maurodelazeri/grpcweb/tree/master/envoy-proxy
Don’t know if it makes sense to re-open this issue but I got the same issue. After downgrading to version 1.0.3 everything works fine.
I’m using the server from here -> https://github.com/improbable-eng/grpc-web/tree/master/go/grpcweb
The thing is, both headers grpc-status and grpc-message are only included in the HTTP response header if a GRPC error returns. If a protobuf message will be returned both headers are missing.
Working request with error response:
OPTIONS:
POST:
Non working request with protobuf response:
OPTIONS:
POST:
Not sure if its defined by GRPC if both headers are required or not but I think one of the project (client or server) does it in the wrong way.