By Lewis Tyler
I have two servers running nginx:
Server 1 has a range of projects on it Server 2 has a new Vue/Nuxtjs (node)
On server 1 I have set up a proxy_pass to the static IP of server 2 where my node based app is running. So the goal is for users to just see http://domain.tld/folder, http://domain.tld/folder/login etc when they browse the site
Server 1:
location /folder/ {
proxy_pass http://200.1.1.1/; // IP of server 2
}
Server 2:
location / {
proxy_pass http://localhost:3000;
}
This works partly but all assets are 404. And when clicking links the browser visits http://domain.tld/login
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello, @ltyler
You’ll need to use/add some extra rules in order to setup this. You can use proxy_set_header to set this. You can try with the following snippet of code on server 1:
location /folder {
proxy_pass http://200.1.1.1/3000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
Let me know how it goes.
Regards, Alex
Hi Alex - thanks for this. It did not seem to have any effect (I made sure to restart nginx)
Do I need to do anything on server 2?
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
