Welcome! Log In Create A New Profile

Advanced

reverse proxy an apache who forces ssl

Isaac Hailperin
July 17, 2012 10:06AM
Hi,

I am trying to proxy an apache, who forces ssl, see my vhost config:

RewriteEngine On
RewriteRule /(.*)$ https://www.acme.eu/$1 [R=301,L]

The nginx config for port 443 looks like this:

[...]
location ~* \.(jpg|gif|png|css|js) {
try_files $uri @proxy;
}
location @proxy {
proxy_pass http://www.acme.eu;
}
location / {
proxy_pass http://www.acme.eu;
}

This obviously gives me a rewrite loop, since apache forces https, and
nginx keeps trying http.
When I change http to https in the location blocks, I get a 502 bad
gateway error, and the nginx log tells me

012/07/17 15:42:30 [error] 3671#0: *21 SSL_do_handshake() failed (SSL:
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol)
while SSL handshaking to upstream, client: 8.1.87.11, server:
www.acme.eu, request: "GET / HTTP/1.1", upstream:
"https://10.11.12.13:443/", host: "www.acme.eu"

My interpretation is that nginx does not know how to handle the upstream
ssl connection. Is that correct?
How can I configure nginx to do that? Is that possible at all?

Not sure if its of interest, but: nginx has the ssl certs for
www.acme.eu configured correctly, but thats for the side where nginx is
the server to the client.
Of course, an option would be to drop the https forcing in the apache,
and put the forcing in nginx, but currently that is not an option, as we
are in a testing phase, where the proxied and unproxied versions of the
site must be available.

Isaac

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

reverse proxy an apache who forces ssl

Isaac Hailperin July 17, 2012 10:06AM

Re: reverse proxy an apache who forces ssl

Reinis Rozitis July 17, 2012 10:18AM

Re: reverse proxy an apache who forces ssl

Isaac Hailperin July 17, 2012 12:46PM

Re: reverse proxy an apache who forces ssl

Reinis Rozitis July 17, 2012 01:30PM

Re: reverse proxy an apache who forces ssl

Isaac Hailperin July 18, 2012 03:38AM

Re: reverse proxy an apache who forces ssl

saucepan July 18, 2012 05:40AM

Re: reverse proxy an apache who forces ssl

Reinis Rozitis July 18, 2012 05:48AM

Re: reverse proxy an apache who forces ssl

Isaac Hailperin July 18, 2012 08:26AM

Re: reverse proxy an apache who forces ssl

saucepan July 17, 2012 01:30PM

Re: reverse proxy an apache who forces ssl

Maxim Dounin July 20, 2012 05:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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