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

Enable gRPC-web calls on providers gRPC port #154

Merged
merged 2 commits into from
Dec 8, 2022

Conversation

0xAleksaOpacic
Copy link
Contributor

@0xAleksaOpacic 0xAleksaOpacic commented Nov 30, 2022

Description

This PR should enable that port that serves gRPC on the provider to accept gRPC-web calls as well. Provider needs to be able to receive gRPC-web calls or it would not be able to receive requests from SDK.

DoD:

  1. Clients who uses SDK on the browser should be able to communicate with a provider using gRPC-web
  2. Nothing can break for existing gRPC calls!

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • New feature (non-breaking change that adds functionality)

@0xAleksaOpacic 0xAleksaOpacic marked this pull request as draft November 30, 2022 15:23
Comment on lines 1151 to 1152
resp.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
resp.Header().Set("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, X-User-Agent, X-Grpc-Web, Grpc-Timeout")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better use use wildcard in both

Copy link
Contributor Author

@0xAleksaOpacic 0xAleksaOpacic Nov 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea agree, this was just copy-pasted from grpc-web library doc to make sure this works.

I will leave this conversation unresolved if we decide to go with this approach to remember to fix it.

Thank you for going over PR and leaving comments 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've double-checked and concluded that we don't need to allow all of this, only the origin and headers needed for grpc-web. What do you think? :D

@0xAleksaOpacic 0xAleksaOpacic marked this pull request as ready for review December 7, 2022 15:27
@0xAleksaOpacic 0xAleksaOpacic force-pushed the feature/implement_grpcweb_listener branch from 94496ff to 86f3e9d Compare December 7, 2022 15:28
@ranlavanet ranlavanet merged commit 84c8b79 into main Dec 8, 2022
@0xAleksaOpacic 0xAleksaOpacic deleted the feature/implement_grpcweb_listener branch December 12, 2022 09:01
@amitza amitza mentioned this pull request Sep 11, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants