Hi everybody
I just heard about the support for Grpc-web in treafik v3, so I tried to test it
I have a python backend service which works with web blazor web client using envoy as reverse proxy but when I use treafik, I'm getting 405 Method not allowed error for OPTIONS preflight request on client side
this is my docker-compose.yaml :
version: '3'
services:
envoy-proxy:
image: aibe-grpc-envoy-proxy:latest
build:
context: ./
dockerfile: Dockerfile_envoy
container_name: envoy-proxy
# network_mode: host
depends_on:
- grpc-server
ports:
- "7070:7070" # The port Envoy will listen on
- "9901:9901" # Envoy admin port (optional)
reverse-proxy:
image: traefik:v3.1
container_name: traefik
ports:
- "80:80" # Web traffic
- "8080:8080" # The port Envoy will listen on
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--entrypoints.web.address=:80"
- "--entrypoints.grpc.address=:5000"
- "--log.level=DEBUG"
- "--accesslog=true"
- "--accesslog.filePath=/logs/access.log"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
grpc-server:
image: aibe-grpc-server:latest
build:
context: ./
dockerfile: Dockerfile_server
container_name: grpc-server
labels:
- "traefik.enable=true"
- "traefik.http.routers.grpc-server.rule=Host(`grpc.localhost`)"
- "traefik.http.services.grpc-server.loadbalancer.server.port=9090"
- "traefik.http.routers.grpc-server.entrypoints=grpc"
- "traefik.http.services.grpc-server.loadbalancer.server.scheme=h2c"
- "traefik.http.middlewares.grpc-middleware.grpcweb.allowOrigins=*"
- "traefik.http.routers.grpc-server.middlewares=grpc-middleware"
As you can see, I also have envoy proxy and it works but my treafik container gives error; I saw that the response of OPTIONS request has header [Allow: GET, HEAD] but envoy response to OPTIONS request has more different headers [access-control-allow-origin: http://localhost:5000
access-control-allow-methods: GET, PUT, DELETE, POST, OPTIONS
access-control-allow-headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout, X-Requested-With, grpc-accept-encoding, Authorization
access-control-max-age: 1728000
access-control-expose-headers: custom-header-1,grpc-status,grpc-message
date: Sat, 07 Sep 2024 10:42:38 GMT
server: envoy
content-length: 0]
Can anybody help me how to solve this problem to make my treafik docker container work with my grpc web client?