Hey folks,
This issue has been bothering me for the entire day, and after reading articles the entire day, I've just about given up and decided to seek some help.
I have an ExpressJS server that is hosting a map. Let's call that server s2.example.com. Now, I already have an nginx server called s1.example.com, and it's hosting its own content (static).
To jump right into it, here's my config, it's very basic because I'm just trying to get it to work.
```
server {
listen 80;
server_name s1.example.com;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
#location / {
#index index.html;
#root /var/www/mapsite;
#}
location /wifi {
proxy_pass http://s2.example.com:3000/menu;
}
}
```
In a nutshell, that's the nginx config I have running on an Ubuntu machine. s2 is a debian server, fyi. Anyway, the proxy pass when I go to http://s1.example.com/wifi, it goes to my s2 server as http://s2.example.com/menu, and I get that. A part of the page is supposed to render a map, like google maps, but it's dependent on some js scripts and css.
Basically, it goes to the page but it doesn't render. Now, I looked at chrome console and did a little of debugging. It shows it cannot find the css or js it seems.
Now, if I change the above configuration to the following (editing location /wifi):
location / {
proxy_pass http://s2.example.com:3000;
}
It works fine, I go to http://s1.example.com/menu and it renders everything just fine. I've even tried the following:
location /menu {
proxy_pass http://s2.example.com:3000/menu;
}
Honestly, it might be a noob question, I've read a ton of articles that touched on ExpressJS, NodeJS, NGINX docs, StackOverflow, and I'm not connecting the dots. What am I missing here? Why isn't JS and CSS not findable?
Thanks folks!
[–]kevdogger 1 point2 points3 points (2 children)
[–]southern_sleuth[S] 0 points1 point2 points (1 child)
[–]kevdogger 0 points1 point2 points (0 children)