0

how are you?

I am presented with a problem, my client asked me to show some custom errors at the time the system is in maintenance or fallen.

When the HTTP Server receives a 503 error, I have no problem. The problem is when I have to show the same maintenance page and I find a 404 error.

This error is presented as follows, the architecture of the system is as follows:

-The HTTP Server v7 in a virtual machine, with load balancing for high availability. -In another VM I have WASCE 1 and WASCE 2. -In another VM, WASCE 3 and WASCE 4.

When the HTTP Server receives a 404 error, it displays the predefined Tomcat error message

Tomcat default 404 error

Even trying to modify the httpd.conf file of the http server did not have any results.

It totally ignores things like "#ErrorDocument 404 /404maintenance.html" or any type of Rewrite Rule.

I found a tutorial that explains that modifying the web.xml file of catalina and placing an ej: myNewError404.html can be modified, since the tomcat default is arriving at the http server.

Tutorial link

The problem is that when I do this, it stops showing me the default tomcat error message, but it shows me a blank screen. Obviously I'm not taking the route in the tag location.

<error-page>
   <error-code>404</error-code>
   <location>/myErrorPage404.html</location>
</error-page>

This problem only happens when the service of any of the four WASCE are up, but the application is stopped.

I try to place my file everywhere, but without result. If someone has any help to solve a problem, thank you very much.

Very good start to the year for everyone!

M I P
  • 867
  • 10
  • 25
R4k4210
  • 31
  • 9

2 Answers2

0

You want to look at the ProxyErrorOverride directive.

http://publib.boulder.ibm.com/httpserv/manual70/mod/mod_proxy.html#proxyerroroverride

covener
  • 17,402
  • 2
  • 31
  • 45
  • Thank you for your comments, I recently found a complementary round to solve my problem. As I was seeing, when the error is sent by the tomcat, the WASCE server can not handle that. And since the WASCE works differently than a tomcat, it is not possible to change the 404 message by default. I'll post briefly how I resolved it. Thank you very much! – R4k4210 Jan 29 '18 at 13:36
0

How are you? Well, I solved the problem I had, in the following way.

Following this tutorial, there is a way to redirect people who try to access the URL of the application, when it is in maintenance.

TUTORIAL

Within the VirtualHost, the first thing I did, was to enable me to take the images that we have in local, because if you want to show a tag, try to take a route with the url of your application.

Then I set the following Alias and the following RewriteRule:

Listen 0.0.0.0:443

<VirtualHost *: 443>

   Alias "/ images" "C: \ IBM \ HTTPServer \ htdocs \ images"
   RewriteRule "/images/(.+)\.png$" "/images/$1.png" [PT]

Then what we do is create a file called serverdown.txt in the folder htdocs of your httpserver, and with the following rule, what we are going to tell you is to check if that file exists in that folder, and if it does exist, they are redirected all connections to your custom maintenance file.

   RewriteCond% {DOCUMENT_ROOT} /serverdown.txt -f
   RewriteRule ^ (. *) $ /404maintenance.html [PT, NC]

Once having this configuration done, the following was to create a .bat with the following code:

@ECHO OFF
if "% 1" == "on" (
  echo The variable is ON
  echo The variable is ON> C: \ IBM \ HTTPServer \ htdocs \ serverdown.txt
) ELSE (
  echo The variable is OFF
  from C: \ IBM \ HTTPServer \ htdocs \ serverdown.txt

In this way, adding the .bat to the bin folder of the httpserver, opening the console and writing "maintenance on", this bat creates the file serverdown.txt and writing "mantenance off", deletes the same file.

I hope it will be you useful. Regards!

My httpd.conf file:

<IfModule mod_ibm_ssl.c>
  Listen 0.0.0.0:443
  <VirtualHost *:443>

    SSLEnable

    RewriteEngine On

    Alias "/images" "C:\IBM\HTTPServer\htdocs\images"
    RewriteRule "/images/(.+)\.png$" "/images/$1.png" [PT]

    RewriteCond %{DOCUMENT_ROOT}/serverdown.txt -f 
    RewriteRule ^(.*)$ /404maintenance.html [PT,NC]

  </VirtualHost>
</IfModule>
R4k4210
  • 31
  • 9