SSL 연결을 종료하는 Apache Forward 프록시를 설정하려고합니다. 내가 이것을하려고하는 이유는 반환 된 코드에서 Apache 필터 (특히 mod_pagespeed)를 실행하기 위해서입니다. mod_pagespeed를 처리하기 전에 응답에 헤더를 삽입하여이 POC를 테스트하고 있는데 (응답을 편집 할 수 있음을 증명할 것임) SSL 프록시 (SSL 프록시가 작동하지 않음)와 관련된 문제가 있습니다. .SSL 종료가있는 Apache 전달 프록시
인증서 오류 등이 걱정되지 않습니다. 이것은 순전히 내부 테스트 용입니다.
내가 설정 한 서버를 가지고와 비 SSL 페이지에서 X-MSCProxy 헤더를 참조했습니다
jshannon-macbookpro:pagespeed_proxy jshannon$ curl -vv --proxy pagespeed_proxy:[email protected]:8080 -D - -o /dev/null http://www.slate.com
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
* Proxy auth using Basic with user 'pagespeed_proxy'
> GET http://www.slate.com/ HTTP/1.1
> Host: www.slate.com
...
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Mon, 30 Oct 2017 18:10:40 GMT
Date: Mon, 30 Oct 2017 18:10:40 GMT
< Server: Apache/2.2.29 (Amazon)
Server: Apache/2.2.29 (Amazon)
...
< Content-Length: 187051
Content-Length: 187051
...
< X-Instart-Request-ID: 8286987369135064135:FWP01-NPPRY22:1509387040:0
X-Instart-Request-ID: 8286987369135064135:FWP01-NPPRY22:1509387040:0
< Via: 1.1 172.17.0.2:8080
Via: 1.1 172.17.0.2:8080
< X-MSCProxy: SansPS
X-MSCProxy: SansPS
을하지만 슬레이트의 SSL 페이지에 동일한 요청을 할 때 나는 볼 수 없습니다 내 프록시 : 나는 시도했습니다 내가 여러 값을 httpd.conf의 제안 (기술적, 그것이 있어야하고)이 가능하다라고 글을 많이 발견했습니다
jshannon-macbookpro:pagespeed_proxy jshannon$ curl -vv --proxy pagespeed_proxy:[email protected]:8080 -D - -o /dev/null https://www.slate.com
* Connected to localhost (::1) port 8080 (#0)
* Establish HTTP proxy tunnel to www.slate.com:443
* Proxy auth using Basic with user 'pagespeed_proxy'
> CONNECT www.slate.com:443 HTTP/1.1
> Host: www.slate.com:443
< HTTP/1.0 200 Connection Established
HTTP/1.0 200 Connection Established
< Proxy-agent: Apache/2.4.25 (Debian)
Proxy-agent: Apache/2.4.25 (Debian)
<
* Proxy replied OK to CONNECT request
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: ssl004.insnw.net
* Server certificate: GlobalSign CloudSSL CA - SHA256 - G3
* Server certificate: GlobalSign Root CA
> GET/HTTP/1.1
> Host: www.slate.com
> User-Agent: curl/7.54.0
> Accept: */*
>
< Content-Length: 187044
Content-Length: 187044
< Connection: keep-alive
Connection: keep-alive
< Server: Apache/2.2.29 (Amazon)
Server: Apache/2.2.29 (Amazon)
< X-Instart-Request-ID: 762420041708891440:FWP01-NPPRY21:1509387251:0
X-Instart-Request-ID: 762420041708891440:FWP01-NPPRY21:1509387251:0
,하지만 아무것도 일했다.
<VirtualHost *:8080>
ProxyRequests On
ProxyVia On
Header set X-MSCProxy SansPS
#SSLEngine On
# suggestion that this allows termination
ProxyPreserveHost On
SSLProxyEngine on
SSLProxyCheckPeerCN Off
SSLProxyCheckPeerExpire Off
SSLProxyCheckPeerName Off
SSLCertificateFile /etc/apache2/ssl/localhost.crt
SSLCertificateKeyFile /etc/apache2/ssl/localhost.key
ModPagespeed Off
</VirtualHost>
FWIW, 내가 (제안 된대로)이 프록시에 SSLEngine를 사용하도록 설정하면 그 요청은 단순히 아파치에서이 오류와 함께 작동하지 않습니다 :
[Mon Oct 30 18:20:20.705047 2017] [ssl:info] [pid 372:tid 140147985901312] [client 172.17.0.1:34012] AH01996: SSL handshake failed: HTTP spoken on HTTPS port; trying to send HTML error page
[Mon Oct 30 18:20:20.705107 2017] [ssl:info] [pid 372:tid 140147985901312] SSL Library Error: error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request -- speaking HTTP to HTTPS port!?
을 지금 내 httpd.conf를 같이 보인다
프록시 프로토콜이 HTTPS 연결을 프록시에 직접 기대하지 않으므로 나는 생각합니다.
. 1) https 클라이언트는 SSL을 통해 프록시로 전달하지 않습니다. 2) 클라이언트가 프록시에 https를 사용하더라도 설정 한 CONNECT 터널을 통해 https 을 계속 사용하므로 프록시는 조작을 통해 HTTP 요청/응답을 볼 수 없게됩니다. 나를 막 다른 골목처럼 보입니다. – covener
확인. 확인 감사합니다. –
프록시로 사용하지 않고 호스트 파일을 사용하여 도메인을 Apache 서버로 지정 한 다음 프록시가 원래 서버로 요청을 전달하는 방법은 무엇입니까? 이것은'https (호스트 파일을 사용하여 변경된 도메인 IP) -> Apache -> 원래 사이트의 https ' –