Welcome! Log In Create A New Profile

Advanced

Nginx reverse proxy redirection

Posted by tonio94 
Nginx reverse proxy redirection
June 16, 2016 06:35AM
Hi,

I am using Nginx as a reverse proxy and when I login in my web interface I am redirected to the original URL. I would like to avoid it and always keep the "server_name" as URL. Is it possible ?

This is my /etc/nginx/conf.d/my_app.conf :

server {
listen 443 ssl;
server_name my-app.net;
ssl_certificate /etc/pki/tls/certs/my-app.cer;
ssl_certificate_key /etc/pki/tls/private/my-app.key;
ssl_protocols TLSv1.1 TLSv1.2;
access_log /var/log/nginx/my-app.access.log main;

location / {
proxy_pass http://ip_of_the_app:7180/;
proxy_redirect off;
}
}

I connect on the http://my-app.net, then enter login informations and I am redirected to http://ip_of_the_app:7180 at the same login page, then I have to login again.

Can you help me on this case ?

Thanks,
Re: Nginx reverse proxy redirection
June 16, 2016 06:38AM
You need to tell the backend (proxy) what it's new external address/port is.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: Nginx reverse proxy redirection
June 16, 2016 07:07AM
How can I do that ?

Thanks.
Re: Nginx reverse proxy redirection
June 16, 2016 07:17AM
Look into the configuration of "http://ip_of_the_app:7180/" and change it to what nginx is using.

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 114
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready