10 months ago
New to caddy proxy:
- Previously had a working NGINX reverse proxy created using frontend Dockerfile to proxy all requests from client side to server side. For a small MERN app. On the backend had Express sessions handling authentication for both user and all CRUD operations (user must be authenticated by session in order to use any CRUD functionality). Ran locally in Docker, ran locally in machine.
- Read discord threads re:Nginx reverse proxy but saw due to DNS caching issues that the template provided by Brody for the caddy proxy was reccomended as the viable alternative.
- Got the template running, set the four required variables for the proxy plus a port. Client side and server side services also have same port set.
- Database from mongo image with volume, is communicating with backend and session store should be happening with the attached volume.
- 401 errors for any CRUD operation, cookie does not seem to be sending.
Newer to Railway and would love to understand how to use the Caddy Proxy. Followed steps in documentation, tried forking and using handle instead of handle_path, didn't run so went back to template and simply stripped out the /api/ prefix server side where it would have been expected.
The requests are logging in the proxy service HTTP log. There's no detail in the backend deployment log but some functionality is happening (example, anything where a cookie would not be sent like login request).
Is there a way to get more detail on backend logging of which requests are recieved?
Is there a way to see logs for the database volume?
App for now is technically deployed but unfortunately unusable for now.
Any help appreciated.
2 Replies
10 months ago
Hello,
If the Caddy proxy is giving you troubles, perhaps you should just eliminate it.
I published that template, and I've since found that most people who use it don't have a good reason to use to, or those who do use it are misinformed on why they should use it.
For the vast majority of applications, you can simply have your frontend call the backend's public URL. That's how railway.com works; it calls a backend on a separate subdomain.
Best,
Brody
Status changed to Awaiting User Response Railway • 10 months ago
Status changed to Awaiting Railway Response Railway • 10 months ago
Status changed to Solved rhw-repo • 10 months ago
