0

There is the problem,

I have configured htaccess to rewrite all access for http to https, its ok. But i need make a exception for Tomcat on 8080 port.

My .htaccess:

RewriteEngine On

# Redirect all HTTP traffic to HTTPS.
RewriteCond %{HTTPS} !=on
RewriteCond "%{SERVER_PORT}" "!^8080$"
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [L,NC,R]

# Send / to /roundcube.
RewriteRule ^/?$ /roundcube [L]

currently when accessing http mydomain.com:8080 am redirected to https mydomain.com:8080 (causing problems with SSL). I need only to be ignored if you use port 8080 by accessing normally http mydomain.com:8080.

0

I solved this with new subdomain and new config for tomcat on /etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>
        ServerName tomcat.mydomain.com

        ServerAdmin postmaster@mydomain.com
        LogLevel warn
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

RewriteEngine on
RewriteCond %{SERVER_NAME} =tomcat.mydomain.com
RewriteRule ^ http://%{SERVER_NAME}:8080%{REQUEST_URI}
</VirtualHost>

For me a new subdomain exclusive for tomcat was even better.

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.