i have two type of web pages,
- static html which has static content
- react js where i have my app functionalities
below is my nginx conf file
# https server
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name dev.app.in;
ssl_certificate /etc/letsencrypt/live/dev.app.in/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/dev.app.in/privkey.pem;
location = / {
resolver 1.1.1.1 ipv6=off valid=30s;
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;
proxy_pass http://app-landing-pre_prod:80;
}
location /fmApp/ {
resolver 1.1.1.1 ipv6=off valid=30s;
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;
proxy_pass http://app-ui-pre_prod:80/fmApp;
}
location /admin/ {
resolver 1.1.1.1 ipv6=off valid=30s;
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;
proxy_pass http://app-ui-pre_prod:80/admin;
}
location /api {
resolver 1.1.1.1 ipv6=off valid=30s;
proxy_pass http://app-pre_prod:8080;
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;
}
}
in above conf , localtion with = / will proxy to my static html page, from there i have redirect functionality which redirect to same domain with different uri
my redirect url https://dev.app.in/app/customer/{id}
here my static page is loading properly but react js was not loading and getting empty web page.
when i replace localtion = / proxy to my react app , i am able to launch my react js app.
seems like location url matching is causing the issue, i have configured as per the below regex pattern discussed.
Guide on how to use regex in Nginx location block section?