Проблема
Привет всем, я пытаюсь, чтобы моя пользовательская страница ошибок отображалась, когда мой локальный сервер node js не возвращает ответ (код ошибки 503
).
Мой apache код
Listen 80
Listen 443
# Routing - redirecting example.com to https
<VirtualHost example.com:80>
ServerName example.com
Redirect permanent / https://example.com/
</VirtualHost>
# Routing - example.com / secure
<VirtualHost example.com:443>
ServerName example.com
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
# This doesn't work
DocumentRoot /var/www/html
ErrorDocument 503 /error.html
# SSL certificate
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
</VirtualHost>
Когда мой сервер node js не работает или не отвечает, я хотел бы вместо этого отправить файл error.html
. Прямо сейчас я получаю эту ошибку, когда я намеренно выключаю свой node js сервер:
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request.
Как я могу заставить его ответить своей ошибкой HTML вместо этого?