Hi
I am testing Nginx as a reverse proxy to replace our aging TMG server and I have got most functions running. My issue is with one of our server.
When browsing to http://external.com/temse the upstream server responds with a location redirect (302)
http://internal.com:80/auth/?id=568607574B2BC6BA182B4DA7761EE245&target=http://internal.com:7400/&
I have managed to change the first part of the URL with the proxy_redirect directve
proxy_redirect http://internal.com:80/ /temseauth/;
so i will get the location URL
http://external.com/temseauth//auth/?id=568607574B2BC6BA182B4DA7761EE245&target=http://internal.com:7400/&
The problem i face is ia cannot modify the second url in the location header, "target=http://internal.com:7400/", it should be modified to "target=https:/external.com/temse/"
Anyone got an ideá what can be done?
below is the complete config:
upstream temse {
server 192.168.0.100:7400;
}
upstream temseauth {
server 192.168.0.100:80;
}
server {
listen *:80;
listen *:443 default ssl;
server_name external.com;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
if ($ssl_protocol = "") {
rewrite ^/(.*) https://$server_name$request_uri? permanent;
}
location /temseauth/ {
proxy_pass http://temseauth/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "";
proxy_connect_timeout 180;
proxy_send_timeout 180;
proxy_read_timeout 180;
}
location /temse/ {
proxy_pass http://temse/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "";
proxy_redirect http://internal.com:80/ /temseauth/;
proxy_connect_timeout 180;
proxy_send_timeout 180;
proxy_read_timeout 180;
}
}
/Ulf
I am testing Nginx as a reverse proxy to replace our aging TMG server and I have got most functions running. My issue is with one of our server.
When browsing to http://external.com/temse the upstream server responds with a location redirect (302)
http://internal.com:80/auth/?id=568607574B2BC6BA182B4DA7761EE245&target=http://internal.com:7400/&
I have managed to change the first part of the URL with the proxy_redirect directve
proxy_redirect http://internal.com:80/ /temseauth/;
so i will get the location URL
http://external.com/temseauth//auth/?id=568607574B2BC6BA182B4DA7761EE245&target=http://internal.com:7400/&
The problem i face is ia cannot modify the second url in the location header, "target=http://internal.com:7400/", it should be modified to "target=https:/external.com/temse/"
Anyone got an ideá what can be done?
below is the complete config:
upstream temse {
server 192.168.0.100:7400;
}
upstream temseauth {
server 192.168.0.100:80;
}
server {
listen *:80;
listen *:443 default ssl;
server_name external.com;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
if ($ssl_protocol = "") {
rewrite ^/(.*) https://$server_name$request_uri? permanent;
}
location /temseauth/ {
proxy_pass http://temseauth/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "";
proxy_connect_timeout 180;
proxy_send_timeout 180;
proxy_read_timeout 180;
}
location /temse/ {
proxy_pass http://temse/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "";
proxy_redirect http://internal.com:80/ /temseauth/;
proxy_connect_timeout 180;
proxy_send_timeout 180;
proxy_read_timeout 180;
}
}
/Ulf