Apache reverse proxy 503 custom page not working properly

apache-2.2centosreverse-proxy

I am trying to setup a custom 503 error page on my website. I am using this apache configuration.

# Exclude the Maintenance directory from being proxied
 ProxyPass /Maintenance !

# ProxyPass other requests to the backend server
ProxyPass / https://local*********:***/
ProxyPassReverse / https://local********:***/

# Set the custom error document for 503 errors
ErrorDocument 503 /Maintenance/index.html

The issue is that the custom page is not able to render its content properly. As the index.html page require images and css.

I am getting 503 error on other pages which require to generate images and css.

[Mon Apr 22 05:15:11.279807 2024] [proxy:error] [pid 3662468:tid 22997273540352] (111)Connection refused: AH00957: https: attempt to connect to**************** failed
[Mon Apr 22 05:15:11.279841 2024] [proxy_http:error] [pid 3662468:tid 22997273540352] ************ AH01114: HTTP: failed to make connection to backend: ************
[Mon Apr 22 05:15:12.881465 2024] [proxy:error] [pid 3662468:tid 22997271439104] (111)Connection refused: AH00957: https: attempt to connect to*************** failed
[Mon Apr 22 05:15:12.881502 2024] [proxy_http:error] [pid 3662468:tid************] AH01114: HTTP: failed to make connection to backend: **********[![enter image description here][1]][1]

enter image description here

Best Answer

It seems your paths are wrong in your html, the css's from /Maintenance/index.html are pointing to /css and not /Maintenance/css.

Your index page in /Maintenance is referring to files outside of the /Maintenance folder, which in this case could be failing due to the Proxy not being up due to Maintenance.

I'd first trying copying the whole of the localhost/css folder into /Maintenance and setting the base tag to be under /Maintenance, with all calls for css being not absolute but relative

I hope that helps.

Related Topic