Using Caddy to serve React app - is it possible to modify Caddyfile to proxy requests to backend?
twilczek
HOBBYOP

2 years ago

Given I have a Node backend called backend running at backend.railway.internal, can I modify this Caddyfile to proxy the requests there?

I've been trying several approaches but none worked.

Use case:

1. From React app do request to /api/users

2. Proxy rewrites from "https://frontend.url.railwy/api/users" to "backend.railway.internal/users"

Right now I'm passing public backend url to frontend to construct the URL

I've been using this template: https://github.com/brody192/vite-react-template

1 Replies

2 years ago

Yes you absolutely could, but you need to ask yourself if the added complexity is necessary? is there anything wrong with having your frontend call the backend domina?


Loading...