First of all, thank you Daniel.
So I need to define a new Virtualhost for the SSL address where I am redirecting the request?It should look like this maybe?<VirtualHost 10.5.129.42:443> #formamos el acceso por https
SSLEngine on
SSLCertificateFile something
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>
Thanks again!
2016-04-01 9:34 GMT+02:00 Daniel <dferradal@xxxxxxxxx>:If I understand correctly you want: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
to show up in the SSL virtualhost.Since these have been defined in the virtualhost context it won't affect other virtualhosts, so you either define these in server config context so they get propagated down the context tree or define them again in the new virtualhost where you need them.El vie., 1 abr. 2016 a las 9:18, Aitor González (<a.gonzalez@xxxxxxxx>) escribió: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)