Routing incoming public/service to multiple internal/service

1. Caddy version (caddy version):


2. How I run Caddy:

a. System environment:

Windows Server 2019

b. Command:

caddy run --watch

c. Service/unit/compose file:

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.

d. My complete Caddyfile or JSON config: {  
    @stuss { path_regexp ^/StudentSelfService(/.*)?$ }
    reverse_proxy @stuss
    @regss { path_regexp ^/StudentRegistration(/.*)?$ }
    reverse_proxy @regss
    @finss { path_regexp ^/FinanceSelfService(/.*)?$ }
    reverse_proxy @finss

3. The problem I’m having:

New to Caddy. Needing to take a single public subdomain and route to separate server:port depending upon services specified in URL.

See configuration in CaddyFile. Browser is giving a blank page for this code. How to resolve? Also, is there a debug or lower level for Caddy logging? If so, how is logging level configured?

For instance routes to routes to

4. Error messages and/or full log output:

Browser shows blank page. Not hitting

5. What I already tried:

6. Links to relevant resources:

That’s quite an old version! Please upgrade to v2.5.1.

That’s not valid matcher syntax. Don’t use braces if you only have a single matcher:

@stuss path_regexp ^/StudentSelfService(/.*)?$

Also, you probably don’t need to use path_regexp here, you can probably just use use a path matcher like /StudentSelfService*. You could write it like this: {
	reverse_proxy /StudentSelfService*
	reverse_proxy /StudentRegistration*
	reverse_proxy /FinanceSelfService*

If your matcher didn’t match, then your request would probably go unhandled according to this config. Caddy’s default behaviour for unhandled requests is to return a blank 200 response – because it worked as configured, you didn’t tell it to do anything else.

You can add the debug global option to set the logging level to debug, which can reveal some extra details. Put this at the top of your config:

1 Like

Thank you for quick responses. Will give those a try and get back to update.

Both methods worked. Thank you


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