set the communication between the front and the backend in prodcution environment
November 16, 2023 04:05AM
Hello, I am trying to make a connectio between a front-end developed in react and a backend in expressjs.

Here is my configuration:


root /var/www/;
index index.html index.htm;

location / {
try_files $uri $uri/ =404;

location /api/ {

# Add a trailing slash if missing
if (!-f $request_filename) {
rewrite [^/]$ $uri/ permanent;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;

I get error 404 on GET
[HTTP/1.1 404 Not Found 275ms]

There is only the login route that is fucntioning when I reload the root
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 76
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready