Skip to content

Commit 31f2732

Browse files
easyCZroboquat
authored andcommitted
[proxy] Route HTTP 1.x requests to public-api-server
1 parent b66a9de commit 31f2732

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

components/proxy/conf/Caddyfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,15 @@ api.{$GITPOD_DOMAIN} {
150150
output stdout
151151
}
152152

153-
reverse_proxy h2c://public-api-server.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:9001
153+
@grpc protocol grpc
154+
155+
handle @grpc {
156+
# gRPC traffic goes to gRPC server
157+
reverse_proxy h2c://public-api-server.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:9001
158+
}
159+
160+
# Non-grpc traffic goes to an HTTP server
161+
reverse_proxy public-api-server.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:9002
154162
}
155163

156164

components/public-api-server/pkg/server/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ func Start(logger *logrus.Entry, version string, cfg *config.Configuration) erro
6262
log.Info("No stripe webhook secret is configured, endpoints will return NotImplemented")
6363
}
6464

65+
srv.HTTPMux().Handle("/test", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
66+
w.Write([]byte(`test`))
67+
}))
6568
srv.HTTPMux().Handle("/stripe/invoices/webhook", handlers.ContentTypeHandler(stripeWebhookHandler, "application/json"))
6669

6770
if registerErr := register(srv, gitpodAPI, srv.MetricsRegistry()); registerErr != nil {

0 commit comments

Comments
 (0)