I basically have to serve static files (front end in React) of the app at domain.com and the admin section (ROR) at domain.com/admin. So, as I’m trying to route the admin section of my Ruby on Rails application to the /admin route,
I tried routing the admin section to just my domain.com and it’s working flawlessly. However, as soon as I route it to /admin, I’m getting a blank page and it’s not getting routed.
That’s because there’s nothing in your Caddyfile that handles requests to /admin, only /admin/. The slash is significant, and sometimes not having it will break front end pages.
Also you can just write it inline: reverse_proxy /admin/* …
To add onto that; you could either change it to /admin*, or add redir /admin /admin/ to make sure the leading slash always exists (which is ideal, to have a canonical URL).
If your upstream app doesn’t know about /admin then it makes sense that it wouldn’t work.
You’d probably be better off making a subdomain like admin.example.com and serve it from there, if you need to continue serving a static site at your apex domain.