Skip to content

Commit

Permalink
Small tweaks to make grpc-web work
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Mar 17, 2024
1 parent 118832e commit e670c8d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.net.URI;
import java.net.URL;
import java.time.Duration;
import reactor.netty.http.client.HttpClient;
import reactor.netty.transport.ProxyProvider;

public class ReactorHttpHelper {
Expand All @@ -35,10 +36,10 @@ public static URL createURL(String url) {
}
}

public static reactor.netty.http.client.HttpClient createReactorClient(
public static HttpClient createReactorClient(
SFProxy proxyData, boolean withBody) {
var base =
reactor.netty.http.client.HttpClient.create()
HttpClient.create()
.responseTimeout(Duration.ofSeconds(5))
.headers(
h -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
syntax = "proto3";

import "google/protobuf/timestamp.proto";
import "com/soulfiremc/grpc/generated/common.proto";

option java_multiple_files = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ public RPCServer(
CorsService.builderForAnyOrigin()
.allowRequestMethods(HttpMethod.POST) // Allow POST method.
// Allow Content-type and X-GRPC-WEB headers.
.allowRequestHeaders(HttpHeaderNames.CONTENT_TYPE, HttpHeaderNames.of("X-GRPC-WEB"))
.allowRequestHeaders(
HttpHeaderNames.CONTENT_TYPE,
HttpHeaderNames.of("X-GRPC-WEB"),
HttpHeaderNames.of("X-User-Agent"),
HttpHeaderNames.AUTHORIZATION
)
// Expose trailers of the HTTP response to the client.
.exposeHeaders(
GrpcHeaderNames.GRPC_STATUS,
Expand Down

0 comments on commit e670c8d

Please sign in to comment.