Use Caddy to reverse_proxy from a url to specfific sub domain

1. Caddy version (caddy version):


2. The problem I’m having:


I try to do a particular setup that would look like this:

I have a domain for my website :

What I want is when someone goes to I would like to proxy it to with being always the same thing.

I tried to use caddyFile with reverse_proxy as the following without success.

:80 {
	reverse_proxy /(.*)) {
		to {1}

Is it possible to do such behavior and if yes It would be really nice if someone could point me into the right direction.

Thanks in advance


This should be possible by doing something like:

redir /specificURL

Hi Paul,

Thanks for the answer. I would like to avoid the usage of redirection because in our infrastructure it would cause SSL issues (the upstream would be under azure cloud domain)

Did you try it like this?

:80 {
@specificURL {
      path /specificURL

reverse_proxy @specificURL {
 // your proxy settings here

Hi Paul,

I will try this, but my asumption is that here the specificURL has to be “known” in advance, it’s not possible to extract the value and apply it dynamically to the reverse proxy right ?


If you want to use regexp, you must use a named matcher. Inline matchers can only be simple path matchers.

See the path_regexp matcher.