Missing content-type header in grpc response

1. The problem I’m having:

I am getting missing content-type header in grpc response on the client side.

2. Error messages and/or full log output:

No error from caddy, only on the client

3. Caddy version:

v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A=

4. How I installed and ran Caddy:

c. Service/unit/compose file:

Docker compose

version: "3.7"

    image: caddy:latest
    restart: unless-stopped
      - NET_ADMIN
      - "80:80"
      - "443:443"
      - "443:443/udp"
      - $PWD/Caddyfile:/etc/caddy/Caddyfile
      - $PWD/site:/srv
      - caddy_data:/data
      - caddy_config:/config

    external: true

d. My complete Caddy config:


servers {
                protocols h1 h2 h2c
https://test.dev {
        #@grpc protocol grpc
        @grpc {
                header Content-Type application/grpc
        handle @grpc {
                reverse_proxy https://testnet.com:9067 {
                        transport http {
                                versions h2c

        header {
          Access-Control-Allow-Headers *
          Access-Control-Allow-Methods *
          Access-Control-Allow-Origin *
        @options {
          method OPTIONS
        respond @options 204

Please fill out the full template. It’s necessary for any support.

Sure! I filled it out.

Still missing the logs

Debug logs looks normal. There are no errors on the server side. The missing content-type header in grpc response is on the client.

Without sharing logs, the best I can tell you is your upstream app is not behaving properly. The upstream IS responsible for setting the content-type. Other than that, you can intercept the response and inject the header.

This is in conflict. If you’re using HTTPS, you’re not using H2C. H2C literally means “HTTP/2 Cleartext”, i.e. HTTP/2 without HTTPS. So it doesn’t make sense to set versions h2c if you’re proxying over HTTPS.

We need to see your reverse_proxy debug logs to see what’s actually going on.

This doesn’t make sense, you’re literally setting those 3 response headers to the value *. That’s incorrect.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.