Welcome! Log In Create A New Profile

Advanced

[yet another] proxy question - rewrite URLs

April 27, 2015 11:05AM
I'm brand new to nginx so apologies in advance if this is the incorrect place to ask but I've been struggling with this for a week without much headway. I'm trying to reverse proxy two hosts behind nginx. The twist is that one of the hosts provides resources that come from another host that's not accessible by the client:


There are three servers in question:

1) ico-proxy
2) webhost1
2) webhost2

webhost1 has login pages at [https]//webhost1/ and [https]//webhost1:8443. These are not visible outside the secure environment. ico-proxy sits on the publicly accessible network and can access webhost1 and webhost2 over ports 443 and 8443.

I can successfully redirect the following using 301 returns:

[http]//ico-proxy/webhost1 -> [https]//ico-proxy

[http]//ico-proxy/webhost2 -> [https]//ico-proxy:8443
e.g.,

location /webhost1/ {
return 301 [https]//$host$request_uri;
}
I then do another redirect inside the 8443 listener:

server {
listen 8443;
servername webhost1;
location / {
proxy_pass [https]//webhost1:8443;
}
}

The above works so far. The problem occurs because there are some links that refer to webhost2 directly. I can fix some of these with proxy_set_header statements. However, webhost1 has multiple links to a page on webhost2.

Is there a way to reverse proxy to webhost1 and somehow intercept all webhost2 requests and in turn proxy them through another port on ico-proxy?

This is for an IBM Cloud Orchestrator (OpenStack based) installation. IBM doesn't have any guidance for this setup. Unfortunately, I can't modify the links from webhost2 as it's a canned app.

Thanks in advance for any guidance on the best way to approach this. I've thought about adding DNS entries for webhost2 that point to ico-host but this breaks other functionality.

KLL
Subject Author Posted

[yet another] proxy question - rewrite URLs

DigitalHermit April 27, 2015 11:05AM

Re: [yet another] proxy question - rewrite URLs

Francis Daly April 30, 2015 01:40PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 259
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