I have a bunch of devices and I want to create a reverse proxy to go to the websites of these devices which are hosted on their IP. The problem is that when I get redirected to the site nothing loads in because the website is trying to get the files (css, js) from localhost instead of the device IP.
How can I change the destination of these calls?
I'm using nginx and this is the config file I use:
server {
listen 3000;
server_name localhost;
location /device {
proxy_pass http://192.168.0.159/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /other-device{
proxy_pass http://192.168.0.162/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
error_log /var/log/nginx/debug.log debug;
}