Skip to content

Commit

Permalink
Merge pull request #1080 from sozu-proxy/templating
Browse files Browse the repository at this point in the history
Dynamic automatic answers system
  • Loading branch information
FlorentinDUBOIS authored Apr 5, 2024
2 parents b41ac3e + ee2430f commit 88547a5
Show file tree
Hide file tree
Showing 29 changed files with 1,807 additions and 740 deletions.
80 changes: 37 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bin/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ address = "0.0.0.0:8443"

# answer_404 = "../lib/assets/404.html"
# answer_503 = "../lib/assets/503.html"
answer_502 = "./502.html"
# sticky_name = "SOZUBALANCEID"

# Configures the client socket to receive a PROXY protocol header
Expand Down
5 changes: 0 additions & 5 deletions command/assets/404.html

This file was deleted.

5 changes: 0 additions & 5 deletions command/assets/503.html

This file was deleted.

4 changes: 2 additions & 2 deletions command/assets/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ buffer_size = 16384
[[listeners]]
address = "0.0.0.0:80"
protocol = "http"
answer_404 = "./assets/404.html"
#expect_proxy = true

[[listeners]]
address = "0.0.0.0:443"
protocol = "https"
answer_404 = "./assets/404.html"
answer_404 = "./assets/custom_404.html"
tls_versions = ["TLS_V12"]

[[listeners]]
Expand All @@ -29,6 +28,7 @@ expect_proxy = true
[clusters]
[clusters.MyCluster]
protocol = "http"
answer_503 = "./assets/custom_503.html"
#sticky_session = false
#https_redirect = false
frontends = [
Expand Down
7 changes: 7 additions & 0 deletions command/assets/custom_404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
HTTP/1.1 404 Not Found
Cache-Control: no-cache
Connection: close
Sozu-Id: %SOZU_ID

<h1>My own 404 error page</h1>
<p>Your request %SOZU_ID found no frontend and cannot be redirected.</p>
11 changes: 11 additions & 0 deletions command/assets/custom_503.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HTTP/1.1 503 Service Unavailable
Cache-Control: no-cache
Connection: close
%Content-Length: %CONTENT_LENGTH
Sozu-Id: %SOZU_ID

<h1>MyCluster: 503 Service Unavailable</h1>
<p>No server seems to be alive, could not redirect request %SOZU_ID.</p>
<pre>
%DETAILS
<pre>
Loading

0 comments on commit 88547a5

Please sign in to comment.