Skip to content

Commit b818059

Browse files
authored
Replace Plausible 502 errors with 424 (#5373)
* Add 502 to the statuses that are replaced with 424 Signed-off-by: Olga Bulat <obulat@gmail.com> * Add 504 and edit comments Signed-off-by: Olga Bulat <obulat@gmail.com> --------- Signed-off-by: Olga Bulat <obulat@gmail.com>
1 parent 370c78c commit b818059

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

frontend/nginx/nginx.conf.template

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ server {
100100
proxy_set_header X-Forwarded-Host $host;
101101

102102
proxy_intercept_errors on;
103-
error_page 503 = @custom_424; # Redirect 503 errors when Plausible is down
103+
error_page 502 503 504 = @custom_424; # Report Plausible errors as Failed dependency
104104
}
105105

106-
# Replace 503 Plausible errors when the service is down with a 424 error.
106+
# Replace Plausible server errors (when the service is down) with a 424 error.
107107
location @custom_424 {
108108
internal;
109109
add_header Content-Type "application/json";
@@ -112,6 +112,6 @@ server {
112112
proxy_set_header X-Forwarded-Proto $scheme;
113113
proxy_set_header X-Forwarded-Host $host;
114114

115-
return 424 '{"error": "Failed Dependency", "message": "Plausible service unavailable."}';
115+
return 424 '{"error": "Failed Dependency", "message": "Plausible service unavailable.", "plausible_status": $upstream_status}';
116116
}
117117
}

0 commit comments

Comments
 (0)