How can I redirect to a static javascript application from a subfolder in the Node.js application on Heroku?

I have a static javascript application built into React that I deployed for firebase and resides in example.firebaseapp.com.

I also have a Node app that serves my main app in www.example.comand is hosted on Heroku.

What I'm trying to understand is how I can visit the user of my static javascript application when visiting this subfolder, for example. www.example.com/app?

Also, is there a way to do this when I don't need to deal with CORS issues, as they will essentially live in the same domain?

+4
source share
1 answer

nginx , . Cors, , .

nginx:

location / {
  proxy_set_header   X-Real-IP $remote_addr;
  proxy_set_header   Host      $http_host;
  proxy_pass         http://YOURTOMCATSERVER:{PORT};
}

location /blog {
  proxy_set_header   X-Real-IP $remote_addr;
  proxy_set_header   Host      $http_host;
  proxy_pass         http://YOURBLOGSERVER:{PORT};
}
+3

Source: https://habr.com/ru/post/1689411/


All Articles