0

I have a React app with an nginx conf as below. This app communicates with a backend (represented here with the alias app-backend in the conf file).

upstream app-backend {
    server app-backend.domain.com;
}

server {
    listen 3000;
    root /usr/share/nginx/html;
    location /api/ {
        proxy_pass https://app-backend/;
        proxy_redirect default;
    }
    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        try_files $uri $uri/ /index.html;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

In the React app, when a user clicks the login button, this code is executed:

      window.location.replace('/api/auth/login');
      return false;

Redirection to the backend does not work though; in the frontend, I get a 404 Not Found nginx/1.17.8 and the frontend UTL changes to app-frontend.domain.com/api/auth/login

By the way, when I test this locally, redirection to my backend is successful, and the authorization server is called as well.

devio
  • 101
  • 2

0 Answers0