0

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 header static-page-provider.com
  • 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

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.

  • Your example uses `/a/b/` but your question uses `/a/b` - these are different URIs. Also, is there anything in the Nginx error? – Richard Smith Jan 23 '20 at 06:41
  • for example; i usr webmail.dom.tld which referers to a other host the user has still only webmail.dom.tld in his browser - so far yes, but i suggest to cache that – djdomi Jan 23 '20 at 07:28
  • If you consider `/a/b` and `/a/b/` to be different URLs, then I would need to catch both using the location block (I will add this as an example) There is nothing else in the nginx error apart from the nginx version, but I will add what I see in my error log. – Cyril Duchon-Doris Jan 23 '20 at 08:59
  • Can you add you **nginx** SSL configuration (`ssl_ciphers` and so on). Maybe **nginx** and the provider do not have any encryption algorithm in common. At the same time, I don't think your web hosting will mind if you add its real domain. – Piotr P. Karwasz Jan 23 '20 at 21:20

0 Answers0