Our company develops a new SaaS solution which will be used by resellers and their customers. For the customers of our resellers should the solution be branded like it is a software application from the reseller himself. This is completely implemented exept 1 thing, the URL.
I did a lot of research how to hide an URL/URI and a reverse proxy seems to be the best solution. I read something about different software applications which i can use to build a reverse proxy and Nginx seems to be perfect for this job.
I installed a fresh CentOS server and i installed Nginx on it. It was pretty easy (even for me as Linix noob). After some struggeling with the config file i found how to configure Nginx as reverse proxy.
Now when i browse to my proxy ip (f.e. 192.168.1.100/SaaS) i see the SaaS solution which has another ip. In the address bar i see the reverse proxy ip, exacly as wished!
After i click on a link or button in the SaaS solution the IP in the address bar changes into the real IP of the SaaS solution.
I read this, this, this and many more topics but i cant get it work.
My config "location" part looks like this atm:
location /SaaS {
proxy_pass http://192.168.1.200/login/;
}
As soon as change it into this (the correct configuration i found on the internet in multiple articles)
location /SaaS {
proxy_pass http://192.168.1.200/login;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
include /etc/nginx/proxy_params;
}
I got an error "The page you are looking for is not found." from Nginx. What do i wrong?
you need to either use a find/replace plugin or update every link in your SaaS app to use the nginx ip (dns would be highly recommend instead)
https://www.nginx.com/resources/wiki/modules/substitutions/
substitute the backend ip with the proxy ip, it's usually possible to rewrite the $host as you have, but it seems your links do not use the variable to set their url.
Example:
http://sub-test.jacobdevans.com/