NoStyle
(Sumit)
January 7, 2024, 6:38pm
1
1. The problem I’m having:
The header-regexp matcher doesn’t work at all.
2. Error messages and/or full log output:
curl localhost:8070 -H "Dev: sumir-10000" -vL
* Trying 127.0.0.1:8070...
* Connected to localhost (127.0.0.1) port 8070 (#0)
> GET / HTTP/1.1
> Host: localhost:8070
> User-Agent: curl/8.1.2
> Accept: */*
> Dev: sumir-10000
>
^C
#request timeout
3. Caddy version:
v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=
4. How I installed and ran Caddy:
brew install caddy
a. System environment:
MacOS
b. My complete Caddy config:
{"apps":{"http":{"servers":{"srv0":{"listen":[":8070"],"routes":[
{"match":[{"header_regexp":{"Dev":{"name":"devno","pattern":"(.*)-(1[0-3]...)"}}}],"handle":[
{"handler":"reverse_proxy","upstreams":[{"dial":"localhost:{re.devno.2}"}]}
]}
],"automatic_https":{"disable":true}}}}}}
5. Links to relevant resources:
Have tried
The issue is due to a misconception about the relationship between matchers and directives . Directives that support matchers take matchers, but not the other way around. I recommend you go over the Caddyfile Concepts — Caddy Documentation page. You will need to use named matchers.
Secondly, the header matcher is case sensitive. To go around this aspect of the header matcher, you need to use the alternative header_regexp matcher. The regular expression engine is Go’s regexp engine whose syntax i…
Proxies requests to one or more backends with configurable transport, load balancing, health checking, request manipulation, and buffering options. | Caddy is a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go
and many many many more different versions…
NoStyle:
{re.devno.2}
This is a Caddyfile-specific placeholder shortcut. See Caddyfile Concepts — Caddy Documentation . In JSON config you need to use {http.regexp.devno.2} instead.
Please use the latest version, v2.7.6.
NoStyle:
2. Error messages and/or full log output:
Where are your Caddy logs? Enable debug level logging.
NoStyle
(Sumit)
January 8, 2024, 3:38am
3
Thank you for your help.
Replacing the placeholder value seems to have fixed the issue.
I was also facing trouble due to another application using the port 8070.
I believe that is why I was unable to get any debug logs to post here and why my request kept timing out.