In my application, I'm making some standard scenario where Java web app is deployed on JBoss with apache proxy upfront. The webapp is accessible from /esp context so direct url would be (but I've turned off HTTP for Jboss, only AJP):

Now, I've created subdomain and tried proxy move through apache root context. So I'd like apache to proxy:

https://mysubdomain.domain.com -> ajp -> Jboss /esp context app

I believe that I'm missing something obvious with my configuration, cause only root application context is accessible, and rest of url have dulicated context which ends with 404. For example request are proxied like this:

https://mysubdomain.domain.com/css/somecss.css -> ajp -> /esp/esp/css/somecss.css

Apache configuration looks like this:

        ServerName mysubdomain.domain.com
        RewriteEngine on
        RewriteCond %{SERVER_PORT} !^443$
        RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R=301,L]

<IfModule mod_ssl.c>
        ServerName mysubdomain.domain.com

        ProxyPass / ajp://localhost:8009/esp/
        ProxyPassReverse / ajp://localhost:8009/esp/

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        <Directory /var/www/mantis>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all

        ErrorLog ${APACHE_LOG_DIR}/error.log

        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/esp.log combined

        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
                Options Indexes MultiViews FollowSymLinks
                AllowOverride None
                Order deny,allow
                Deny from all
                Allow from ::1/128

        SSLEngine on

        SSLCertificateFile    /var/keys/server.crt
        SSLCertificateKeyFile /var/keys/server.key

        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars
        <Directory /usr/lib/cgi-bin>
                SSLOptions +StdEnvVars

        BrowserMatch "MSIE [2-6]" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown


Moreover, when I add additional proxies upfront, everything works:

        ProxyPass /esp/ ajp://localhost:8009/esp/
        ProxyPassReverse /esp/ ajp://localhost:8009/esp/

Except that app is accessible from apache on both context: / and /esp while I want only root. How can I fix it?

1 Answer 1


I had already similar trouble like the one you have here, and finally found my relevant configuration (adapted to the configuration you posted):

ProxyRequests Off
ProxyPass / ajp://localhost:8009/esp/
ProxyPassReverse / http://mysubdomain.domain.com/esp/
ProxyPassReverse / https://mysubdomain.domain.com/esp/
ProxyPassReverseCookiePath "/esp" "/"

Initially I had troubles with ProxyPassRevers but also with the cookie path, even perhaps you could need a ProxyPassReverseCookieDomain Directive (in my case I didn't need it).

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.