1. Caddy version (caddy version
):
2.3.0 / 2.4.0-beta.2
2. How I run Caddy:
a. System environment:
Operating System: KDE neon 5.21
Kernel Version: 5.4.0-70-generic
OS Type: 64-bit
Docker version 20.10.6, build 370c289
curl 7.68.0
b. Command:
Tried both of them
./caddy --config Caddyfile
docker run --rm --name test-caddy --mount type=bind,source="$(pwd)/Caddyfile",target=/srv/Caddyfile --network host caddy:2.4.0-beta.2-alpine caddy run
c. Service/unit/compose file:
d. My complete Caddyfile or JSON config:
http://localhost:3010 {
@uaprom {
path /graphql
}
reverse_proxy @uaprom https://prom.ua {
transport http {
tls_insecure_skip_verify # not affect
}
}
}
3. The problem I’m having:
Trying to proxy requests from my local app to external site for development purposes. But we need Host
header to be set and it can differ from requested URL. Please can you sugges any help with if it is possible. Currently I didn’t find any mentions of this problem in other topics. Thank you
4. Error messages and/or full log output:
Expected behavior:
curl -v -H "Host: prom" localhost:3010/graphql
should return 405 status code, as request really proxied to prom.ua/graphql
Current behavior:
Caddy return default 200 status code, as request not matched to Caddyfile rules
$ curl -v -H "host: prom.ua" localhost:3010/graphql
...
* Connected to localhost (::1) port 3010 (#0)
> GET /graphql
> Host: prom.ua
> User-Agent: curl/7.68.0
> Accept: */*
>
< HTP/1.1 200 OK
< Server: Caddy
< Date: Mon, 12 Apr 2021 18:33:39 GMT
< Content-Length: 0
Notes:
Removing Host header allow to get correct response (404 status code), so I can’t get why there are troubles with matching Host header requests
$ curl -v localhost:3010/graphql
...
> GET /graphql
> Host: localhost:3010
> User-Agent: curl/7.68.0
...
< HTP/1.1 405 Method Not Allowed
< Allow: POST
< Server: Caddy
< Server: nginx
< Set-Cookie: ....
<html>
...
<h1>405 Method Not Allowed</h1>
...
5. What I already tried:
header_up Host prom.ua
matcher rules on header Host *
Tried to wrap it as handler handle @uaprom {