I've setup a server with an Nginx config for a React frontend and Node backend.
The Node app serves as an API for the react app. The node routes for /api/... are getting passed to the following path: /client/public/api/... This results in a 404.
I understand what may be adding this, I assume the root definition has the /client/public/ path definition. But cannot find a solution around it with the Nginx Config, attached below.
The /client/public/ part of the path string should not be in the uri of the request URL.
server {
listen 80;
server_name www.domain.com;
root /var/www/site_folder/client/public;
index index.html;
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
}
location /api/(.*)$ {
proxy_pass http://localhost:5000;
}
location ~ /\.ht {
deny all;
}
}