2

I am having trouble with getting proxypass to work in apache.

My configuration file is as follows:

<VirtualHost 1.2.3.4:443>

    ServerName example.com
    ServerAlias www.example.org
    ServerAdmin info@example.org
    DocumentRoot /home/admin/web/knyz.org/public_html
    ScriptAlias /cgi-bin/ /home/admin/web/knyz.org/cgi-bin/
    Alias /vstats/ /home/admin/web/knyz.org/stats/
    Alias /error/ /home/admin/web/knyz.org/document_errors/
    #SuexecUserGroup admin admin
    CustomLog /var/log/apache2/domains/knyz.org.bytes bytes
    CustomLog /var/log/apache2/domains/knyz.org.log combined
    ErrorLog /var/log/apache2/domains/knyz.org.error.log
    <Directory /home/admin/web/knyz.org/public_html>
        AllowOverride All
        SSLRequireSSL
        Options +Includes -Indexes +ExecCGI
    </Directory>
    <Directory /home/admin/web/knyz.org/stats>
        AllowOverride All
    </Directory>
    SSLEngine on
    SSLVerifyClient none
    SSLCertificateFile /home/admin/conf/web/ssl.knyz.org.crt
    SSLCertificateKeyFile /home/admin/conf/web/ssl.knyz.org.key
    SSLCertificateChainFile /home/admin/conf/web/ssl.knyz.org.ca
    <IfModule mod_ruid2.c>
        RMode config
        RUidGid admin admin
        RGroups www-data
    </IfModule>
    <IfModule itk.c>
        AssignUserID admin admin
    </IfModule>

    IncludeOptional /home/admin/conf/web/sapache2.knyz.org.conf*

    ##ISSUE IS HERE!!!
    <Location /admin>
        ProxyPass https://localhost:8083
        ProxyPassReverse https://localhost:8083
    </Location>
</VirtualHost>

Desired result: The page from localhost on port 8083 will be shown when accessing the /admin subdirectory.

Actual result: Error 500

The issue seems to be the same as here: Apache ProxyPass with SSL

Except the solution does not work for me.

When attempting to do so, I get the following error while restarting apache:

SSLProxyEngine not allowed here

From error logs (concerning error 500):

[Sun Dec 13 21:33:31.062959 2015] [ssl:error] [pid 1181] [remote 127.0.0.1:8083] AH01961: SSL Proxy requested for example.org:443 but not enabled [Hint: SSLProxyEngine]
[Sun Dec 13 21:33:31.063033 2015] [proxy:error] [pid 1181] AH00961: HTTPS: failed to enable ssl support for 127.0.0.1:8083 (localhost)

How can I fix this issue?

Update

I replaced the location block with the following

ProxyPreserveHost On
  ProxyPass /blog http://127.0.0.1:2368/blog
  ProxyPassReverse /blog http://127.0.0.1:2368/blog
  ProxyPass /admin https://127.0.0.1:8083
  ProxyPassReverse /admin https://127.0.0.1:8083

And now /blog works properly but /admin DOES NOT. This means that the issue is definitely with the SSL.

  • @ekaj I happened to test what you proposed even before seeing your answer ;) Anyways updated question. Issue must be with HTTPS – Slava Knyazev Dec 14 '15 at 4:44
  • Note: My setup is configured as such that I am forced to use https on port 8083 – Slava Knyazev Dec 14 '15 at 4:44
  • @ekaj SSLProxyEngine On did the trick. Also yes everything is setup as intended. It's a bit of a weird setup but it works the way I need it to. – Slava Knyazev Dec 14 '15 at 4:56
  • @ekaj Want to write an answer with SSLProxyEngine so I can close the question? – Slava Knyazev Dec 14 '15 at 4:56
4

From what I can tell ProxyPass isn't meant to be used inside of a block - you have it in a <Location> block. It needs to be out of that block, and you need to turn SSLProxyEngine on as well:

    SSLProxyEngine On
    ProxyPass /admin https://localhost:8083/
    ProxyPassReverse /admin https://localhost:8083/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.