I have designed a page on a static page provider, and I'd like to make it available when browsing a domain I own www.example.org (which hits a nginx server)
Target : https://www.example.org/a/b
--> https://static-page-provider.com/c
- The user types
https://www.example.org/a/b
in the URL - The nginx proxy I own hosted at
https://www.example.org
receives the request on the exact path /a/b and must proxy-pass :- The remote server should receive a GET request at
https://static-page-provider.com/c
with HOST headerstatic-page-provider.com
- The remote server should receive a GET request at
- The user should see
https://www.example.org/a/b
in the URL - It should work the same for the final address with a slash
https://www.example.org/a/b/
-->https://static-page-provider.com/c/
(I don't actually care if it's/c/
or just/c
for any of the 2 cases
Should be preserved
- https://www.example.org/a/b2 --> https://www.example.org/a/b2
- https://www.example.org/a/b/c --> https://www.example.org/a/b/c
- https://www.example.org/a --> https://www.example.org/a
Is it possible ? (or are there security implications that make this impossible ?). I'm getting a 502 Bad Gateway and I see a SSL related error in my log
2020/01/23 08:59:43 [error] 30072#0: *499 SSL_do_handshake() failed (SSL: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error) while SSL handshaking to upstream, client: 172.31.28.3, server: www.example.org, request: "GET /a/b/ HTTP/1.1", upstream: "https://xx.xx.xx.xx:443/c/", host: "www.example.com"
when trying the config below. I'm also not sure this config does an exact match or not (is /a/b/c
targeted by the rule ?).
location /a/b/ {
proxy_pass https://static-page-provider.com/c/;
proxy_set_header host mydomain.static-page-provider.com;
}
Is it possible, if the actual URL containing the final content https://static-page-provider.com/c/
returns a 301 redirect (for example to https://static-page-provider-2.com/c/
), to follow the redirection for the user, and the user still sees https://www.example.org/a/b
?
Using nginx/1.12.2
EDIT : it kinda works when using a proxy_pass on the static provider without httpS, but then I need to have a secure connection.