Header_regexp not working :/

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

and many many many more different versions…

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.

Where are your Caddy logs? Enable debug level logging.

1 Like

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.

1 Like

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