Apache RewriteEngine affecting tomcat - Ubuntu 16 server

0

I have the following problem.

I configured the htaccess file so that all requests are redirected to use ssl (https). I have just installed Tomcat on the server and I needed to "ignore" the redirect in case of port 8080 access (tomcat default port), I modified the htaccess file as follows:

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]

However when trying to access the domain by the browser on port 8080 "my.hostname.com:8080" it rewrites the URL to " link "I would like that in this specific case there was no change or when I accessed" my.hostname.com.br:8080 "just go to" link " Normally.

How do I proceed?

    
asked by anonymous 23.08.2016 / 15:17

1 answer

0

After creating a new subdomain, I was able to do the specific rewrite configuration for the subdomain.

in the file "/etc/apache2/sites-enabled/000-default.conf" includes the following discussion.

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

        ServerAdmin [email protected]
        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 it worked, because using another exclusive subdomain for tomcat was even better for me.

    
25.08.2016 / 14:15