question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`DocService` gRPC set host name explicitly

See original GitHub issue

Some HTTP headers do not exist when I check chrome devtools to see which headers are sent. How can I send grpc requests with headers in this case? There can be some auth tokens needed in order to test those endpoints.

Some example headers: host, origin, content-type.

Screen Shot 2022-10-13 at 15 49 10

Also I want to be able to set the host, for example we can have different URLs for local, test and production environments and I want to be able to send to the specified URL from this page.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ikhooncommented, Oct 18, 2022

I understood your problem. 😀 Armeria provides a port-based virtual hosting for that usage. https://github.com/line/armeria/blob/39df04b928d5125d3fb7a8a42651817df4200adc/spring/boot2-autoconfigure/src/main/java/com/linecorp/armeria/spring/ArmeriaSettings.java#L67-L69 If you are not using Spring auto-configuration, we can manually make some internal services be bound to internal ports (18080).

Server.builder()
      .virtualhost(internalPort)
      .serviceUnder("/docs", new DocService())
      .build();

If you don’t like the port-based virtual hosting, we may offer an option to allow additional hostnames for DocService.

DocService.builder()
          .exampleDomains("http://test2.com/my-service/docs")
          ...
1reaction
minwooxcommented, Oct 17, 2022

Hi, we are using fetch API inside and Host and Origin headers are forbidden to overwrite. https://stackoverflow.com/a/43285338 https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name

I guess if you want to change the host header, you need to actually reconnect the domain through the browser. Except those headers, we can set them via the HTTP HEADERS section.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Browsing and invoking services with DocService
Browsing the list of gRPC, Thrift or annotated services and their operations available in the server; Invoking a service operation from a web...
Read more >
gRPC apps cannot be invoked without setting host explicitly
When you deploy a gRPC app to Knative, you have to explicitly specify its hostname. For example, if an app is calling into...
Read more >
Service Config in gRPC
In the gRPC client API, where users can set the service config explicitly. This is intended for use in unit tests. Powered by...
Read more >
Basics tutorial | Java - gRPC
Use the Java gRPC API to write a simple client and server for your ... proto packages are not expected to start with...
Read more >
Implementing a gRPC Service - Quarkus
In test or production mode, you need to enable it explicitly by setting quarkus.grpc.server.enable-reflection-service to true .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found