0

I have set up React + Flask app on windows IIS it is working fine. Now I want to use Nginx instead of IIS. I have created URL Rewrite in IIS from fronted to backend waitress server API calls.

photo for reference .

What will be the syntax for creating the same entry on Nginx Rewrite?

Following is nginx current config, I tried but got a network error during login.

Error Reference Error Reference 2

Following are details of the server and port:-

  • Machine:- Windows
  • Frontend :- http://localhost (Nginx)
  • Backend:- http://localhost:5000 (Waitress)
server {
    listen 0.0.0.0:80 default;
    server_name localhost;
    error_log c:/nginx/logs/front_end.log;
    access_log c:/nginx/logs/front_end_access.log;
    root D:/Simsight/frontend/dist/apps/simsight;
    index index.html index.htm;
    try_files $uri /index.html;
    location / {
        try_files $uri $uri/ = 404;
   # if ($request_uri !~ "/api(.*)$"){
    #    rewrite ^/api http://localhost:84/api/$1 redirect;
    #}
    }
    location /api {
        rewrite api(.*)$ http://localhost:5000$request_uri last;
    }
        #rewrite /api(.*)$ http://localhost:5000/api$1 last;
    
}
Lex Li
  • 1,235
  • 8
  • 10

0 Answers0