1. Caddy version (v2):
2. How I run Caddy:
docker-compose start caddy
a. System environment:
Ubuntu 20.04
b. Command:
docker-compose restart caddy
c. Service/unit/compose file:
version: '3.6'
services:
postgres:
image: postgres:12
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: *****
graphql-engine:
image: hasura/graphql-engine:v2.9.0-beta.1
depends_on:
- "postgres"
restart: always
environment:
## postgres database to store Hasura metadata
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:*****@postgres:5432/postgres
## enable the console served by server
HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set "false" to disable console
## enable debugging mode. It is recommended to disable this in production
HASURA_GRAPHQL_DEV_MODE: "true"
## uncomment next line to set an admin secret
HASURA_GRAPHQL_ADMIN_SECRET: ********************
HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_REFETCH_INTERVAL: 50
HASURA_GRAPHQL_STREAMING_QUERIES_MULTIPLEXED_REFETCH_INTERVAL: 50
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: public
HASURA_GRAPHQL_EXPERIMENTAL_FEATURES: streaming_subscriptions
command:
- graphql-engine
- serve
caddy:
image: caddy/caddy
depends_on:
- "graphql-engine"
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_certs:/root/.caddy
volumes:
db_data:
caddy_certs:
d. My complete Caddyfile or JSON config:
(common) {
header {
-Server
}
}
https://mywebsite.com {
reverse_proxy * graphql-engine:8080 {
header_up X-Hasura-User-Id {http.request.header.Access-Token}
}
import common
}
3. The problem I’m having:
Hello everyone, I have a GraphQL engine setup using Hasura docker image and it includes the caddy configuration. I manipulated the reverse proxy header so I can pass the Access-Token
to the X-Hasura-User-Id
.
Caddyfile works well and sending the headers with GraphQL query (get request through HTTPS), however, the {http.request.header.*}
including Access-Token
are not being passed when using graphQL subscription (websocket WSS connection).
WSS works perfectly though but headers are not being sent.
4. Error messages and/or full log output:
5. What I already tried:
- @websockets matchers
- request_header before reverse_proxy