How to redirect calls to /api in nginx
I bought a VPS to host my first full stack application, I decided to use SvelteKit for the frontend and actix_web for the backend so far this is my server: #[get("/ping")] async fn ping() -> impl Responder { "pong!" } What I want to do is redirect calls to /api to this server and calls to / to my SvelteKit app , so /api/ping calls localhost:8080/ping and /ping calls localhost:8080/ping This is the nginx configuration I tried which doesn't work: http { server { location / { proxy_pass http://127.0.0.1:5173/; } location /api { proxy_pass http://127.0.0.1:8080/; } } } I would appreciate help.
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.