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 error using Go GRPC Gateway #435

eberkund opened this issue Jan 12, 2019 · 1 comment


None yet
2 participants
Copy link

commented Jan 12, 2019

I have a Golang GRPC server on port 9090 and a proxy server using on port 9191.

I generated TypeScript code from my .proto file using

protoc -I=proto api.proto \
--js_out=import_style=commonjs:frontend/src/generated \

However I get this error when I try to make requests

    const url = new URL(window.location.href);
    url.protocol = 'http';
    url.port = '9191';

    // @ts-ignore
    const service = new PublicClient(url.href, {}, {
      // suppressCorsPreflight: true,
    const request = new OpenFolderRequest();

    service.openFolder(request, {},
      (err: grpcWeb.Error, response: OpenFolderResponse) => {
        commit('setSession', p);
        commit('setFolder', response.getShotsList());
Access to XMLHttpRequest at 'http://localhost:9191/#//api.Public/OpenFolder' from origin 'http://localhost:3984' has been blocked by CORS policy: Request header field x-user-agent is not allowed by Access-Control-Allow-Headers in preflight response.

When I enable suppressCorsPreflight then I no longer get CORS errors but then I get this weird query string when I make the request and a 404 error


I am able to make regular HTTP JSON requests just fine.


This comment has been minimized.

Copy link

commented Jan 14, 2019

I don't believe supports grpc-web. You need to use Envoy for that purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.