I have an application behind a Nginx reverse proxy that I am trying to access from an external client. Both the client and the application only support http. Therefore I am using Stunnel on the client side to map http to https and nginix on the server side to map https back to http for the application (which is hosted on a different server). Web browser access works as expected. That is a web browser can access the http server resource as https. However the Stunnel client fails with the following in the Nginx log:
/usr/share/nginx/html/r3/metadata" failed (2: No such file or directory), client: x.x.x.x, server: _, request: "GET /r3/metadata HTTP/1.1", host: "127.0.0.1:9080"
My Nginix config is as follows:
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://192.168.1.2:9080/;
#proxy_redirect http:// https://;
}
And Stunnel
verify = 0
debug = 7
foreground = yes
[MyApp]
client = yes
accept = 127.0.0.1:9080
connect = foo.bar.com:443
The Stunnel logs give no indication of what is going wrong. It seems that for some reason the Nginx server is looking it the local server (that is itself) for the resource rather than the internal application server - but this only happens with Stunnel on the remote client - not web browser.