LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-21-2016, 03:29 PM   #1
ariva
LQ Newbie
 
Registered: Oct 2015
Posts: 6

Rep: Reputation: Disabled
Apache reverse proxy with SSL frontend gives bad gateway error


OS: CentOS 7
Apache package: httpd-2.4.6-40.el7.centos.4.x86_64
Proxy modules: proxy_module, proxy_ajp_module, proxy_balancer_module, proxy_connect_module, proxy_express_module, proxy_fcgi_module, proxy_fdpass_module, proxy_ftp_module, proxy_http_module, proxy_scgi_module, proxy_wstunnel_module
My goal is to launch reverse proxy terminating SSL, then pass proxy request to the backend via plain http:
SSL from brower to Proxy only: Browser (https) --> Proxy Inbound (https) / Proxy Outbound (http) --> Backend server (http)
I have problem with reverse proxy when SSL engine is enabled on the front-end side.
When i put plain http on the front, the problem goes away. When i disable reverse proxy, and put example html document, problem does not appear.
My current config:
Code:
<VirtualHost 10.2.2.2:443>
    ServerAdmin itlinux@domain.local
    ServerName  example.domain.com:443
    ErrorLog    logs/example.domain.com-error_log
    TransferLog logs/example.domain.com-access_log
    CustomLog   logs/example.domain.com-request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
    LogLevel    debug
    SetEnv           proxy-nokeepalive 1
    ProxyPreserveHost On
    ProxyRequests    Off
    ProxyPass        / http://10.1.1.1:80/ retry=30 acquire=3000 timeout=6000
    ProxyPassReverse / http://10.1.1.1:80/
    <Proxy *>
      Require ip 10.0.0.0/8
    </Proxy>
    SSLEngine      on
    SSLHonorCipherOrder on
    SSLProtocol    all -SSLv2
    SSLCipherSuite HIGH:MEDIUM:!ADH:!AECDH:-ADH-DES-CBC3-SHA:-ADH-RC4-MD5:-ADH-AES128-SHA:-ADH-AES256-SHA
    SSLCertificateFile    /etc/pki/tls/certs/multi_domain.com.crt
    SSLCertificateKeyFile /etc/pki/tls/private/multi_domain.com.key
    SSLCertificateChainFile /etc/pki/tls/certs/sub_ca.crt
</VirtualHost>
I receive
Bad Gateway
The proxy server received an invalid response from an upstream server.
Error page and get following info on the error_log:
Code:
[ssl:debug] [pid 3505] ssl_engine_io.c(1201): (104)Connection reset by peer: [remote 10.1.1.1:80] AH02007: SSL handshake interrupted by system [Hint: Stop button pressed in browser?!]
[ssl:info] [pid 3505] [remote 10.1.1.1:80] AH01998: Connection closed to child 0 with abortive shutdown (server example.domain.com:443)
[proxy:error] [pid 3505] (104)Connection reset by peer: [client 10.0.0.4:50507] AH01084: pass request body failed to 10.1.1.1:80 (10.1.1.1)
[proxy_http:error] [pid 3505] [client 10.0.0.4:50507] AH01097: pass request body failed to 10.1.1.1:80 (10.1.1.1) from 10.0.0.4 ()
[proxy:debug] [pid 3505] proxy_util.c(2218): AH00943: HTTP: has released connection for (10.1.1.1)
[ssl:debug] [pid 3505] ssl_engine_io.c(992): [client 10.0.0.4:50507] AH02001: Connection closed to child 0 with standard shutdown (server example.domain.com:443)
Due to that information, my assumption is that the Apache server tries to communicate with the backend using SSL handshake. Am i correct? If so, how could i force it to use plain HTTP protocol to the backend?
 
Old 09-22-2016, 03:13 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Since you're running a reverse proxy, you should ditch:
Quote:
<Proxy *>
Require ip 10.0.0.0/8
</Proxy>

Also note that you should disable SSLv3 due to the poodle bug. You need to use:
Code:
SSLProtocol All -SSLv2 -SSLv3
Regards
 
Old 09-22-2016, 08:25 AM   #3
ariva
LQ Newbie
 
Registered: Oct 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks for the suggestion. I did not metioned that i have already tried the config without ip or SSL cipher restrictions, without any change. In fact the problem is soved now. I have cleared all config adapted from old apache service to the new one, reinstall apache service and applying little by little the config to the new one. I am still investigating what was the casue for ssl comunication with the backends. I'll put it here if i find it.
 
  


Reply

Tags
apache, reverse proxy, ssl



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Odoo 8 with SSL Reverse Proxy using Apache LXer Syndicated Linux News 0 11-26-2014 06:36 PM
Reverse Proxy - Frontend - Tomcat (Suggestions?) Orangutanklaus Linux - Server 0 08-30-2013 12:44 PM
Setting up Reverse Proxy With SSL Support On Apache And Multiple Addreses vglover Linux - Server 7 07-30-2012 05:00 PM
Bad Gateway using Apache as rev proxy for Exchange 2007 rvicker Linux - Server 7 11-29-2011 01:02 PM
Apache, reverse proxy, and SSL Phaethar Linux - Software 4 05-27-2010 12:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration