Using Apache 2.2, I am trying to redirecting HTTP requests to HTTPS requests to a Tomcat 6 server and that works fine.
But I am trying to redirect errors to custom error pages and while that works as long as I don't redirect the HTTP requests to HTTPS requests, it doesn't work when I redirect. This is the configuration I am currently using: # gestion Stofi <VirtualHost 10.5.129.42:80> #formamos el acceso por https RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} ServerAlias gestionfico.media-saturn.com DirectoryIndex /Stofi ProxyPass /Stofi ajp://10.5.129.42:8009/Stofi ProxyPassReverse /Stofi ajp://10.5.129.42:8009/Stofi ErrorLog "logs/Stofi-apache-error.log" CustomLog "logs/Stofi-apache-access.log" common #ErrorLog "Z:/Stofi_Logs/Apache2_Stofi-apache-error.log" #CustomLog "\\ficodb\DocumentosFico\Stofi_Logs\Apache2_Stofi-apache-access.log" ErrorDocument 404 /error_stofi_404.html ErrorDocument 500 /error_stofi_500.html ErrorDocument 502 /error_stofi_502.html ErrorDocument 503 /error_stofi_503.html ErrorDocument 504 /error_stofi_504.html <Location /Stofi> Order allow,deny Allow from all </Location> </VirtualHost> Those error pages are located on htdocs Apache folder. I have been reading about flags on another post to redirect 404 errors but I understant that it only will work when the page it's absolutely not reachable, but in the case I am trying, the Tomcat 6 server is down, and it should return a 503 error. Why when I do not redirect HTTP to HTTPS it works but it doesn't when I redirect? How can I achieve the same behavior? Thank you all. (I have also posted this question on StackOverflow, you can follow this link to the question: http://stackoverflow.com/questions/36281763/show-custom-error-pages-while-redirecting-to-https-on-apache-2-2 )