From 9f86bd11425f15c44334b353e41e0f12e351a070 Mon Sep 17 00:00:00 2001 From: mr-forust Date: Wed, 21 Jan 2026 17:39:14 +0100 Subject: [PATCH 1/2] feat: add errorpage-handler service (403,404, 500, 502-504) --- errorpage/Dockerfile | 5 + errorpage/compose.yaml | 19 ++++ errorpage/html/403.html | 40 +++++++ errorpage/html/404.html | 39 +++++++ errorpage/html/500.html | 39 +++++++ errorpage/html/502.html | 39 +++++++ errorpage/html/503.html | 39 +++++++ errorpage/html/504.html | 39 +++++++ errorpage/html/assets/css/style.css | 167 ++++++++++++++++++++++++++++ 9 files changed, 426 insertions(+) create mode 100644 errorpage/Dockerfile create mode 100644 errorpage/compose.yaml create mode 100644 errorpage/html/403.html create mode 100644 errorpage/html/404.html create mode 100644 errorpage/html/500.html create mode 100644 errorpage/html/502.html create mode 100644 errorpage/html/503.html create mode 100644 errorpage/html/504.html create mode 100644 errorpage/html/assets/css/style.css diff --git a/errorpage/Dockerfile b/errorpage/Dockerfile new file mode 100644 index 0000000..712656b --- /dev/null +++ b/errorpage/Dockerfile @@ -0,0 +1,5 @@ +FROM nginx:alpine +RUN rm -rf /usr/share/nginx/html/* +COPY html /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/errorpage/compose.yaml b/errorpage/compose.yaml new file mode 100644 index 0000000..c0c0783 --- /dev/null +++ b/errorpage/compose.yaml @@ -0,0 +1,19 @@ +services: + errorpage: + build: . + container_name: error-page + # ports: + # - 80 + networks: + - proxy + labels: + - "traefik.enable=true" + - "traefik.docker.network=proxy" + - "traefik.http.services.errorpage.loadbalancer.server.port=80" + # Error handler middleware + - "traefik.http.middlewares.error-pages.errors.status=400-599" + - "traefik.http.middlewares.error-pages.errors.service=errorpage" + - "traefik.http.middlewares.error-pages.errors.query=/{status}.html" +networks: + proxy: + external: true diff --git a/errorpage/html/403.html b/errorpage/html/403.html new file mode 100644 index 0000000..a9db107 --- /dev/null +++ b/errorpage/html/403.html @@ -0,0 +1,40 @@ + + + + + + + 403 // Forbidden + + + + + + + +
+
+

403

+

> Forbidden / Access Denied.

+
+ +
+ +
+

./error_message

+

You do not have permission to access this resource.

+
+

Check the System Status if you believe this is an + error.

+
+ +
+

root@error:~$ sudo access_resource

+

User is not in the sudoers file. This incident will be reported.

+

© XRock - Just Signal.

+
+
+ + + + \ No newline at end of file diff --git a/errorpage/html/404.html b/errorpage/html/404.html new file mode 100644 index 0000000..e766bae --- /dev/null +++ b/errorpage/html/404.html @@ -0,0 +1,39 @@ + + + + + + + 404 // Not Found + + + + + + + +
+
+

404

+

> Page Not Found / Lost in the Void.

+
+ +
+ +
+

./error_message

+

The page you are looking for does not exist or has been moved.

+
+

Check the System Status if you believe this is an error.

+
+ +
+

root@error:~$ ping target

+

Destination Host Unreachable

+

© XRock - Just Signal.

+
+
+ + + + diff --git a/errorpage/html/500.html b/errorpage/html/500.html new file mode 100644 index 0000000..8d66073 --- /dev/null +++ b/errorpage/html/500.html @@ -0,0 +1,39 @@ + + + + + + + 500 // Server Error + + + + + + + +
+
+

500

+

> Internal Server Error / System Failure.

+
+ +
+ +
+

./error_message

+

Something went wrong on our end. We are working to fix it.

+
+

Check the System Status for more information.

+
+ +
+

root@error:~$ systemctl status service

+

Active: failed (Result: core-dump)

+

© XRock - Just Signal.

+
+
+ + + + \ No newline at end of file diff --git a/errorpage/html/502.html b/errorpage/html/502.html new file mode 100644 index 0000000..9df57c1 --- /dev/null +++ b/errorpage/html/502.html @@ -0,0 +1,39 @@ + + + + + + + 502 // Bad Gateway + + + + + + + +
+
+

502

+

> Bad Gateway / System Failure.

+
+ +
+ +
+

./error_message

+

The server received an invalid response from the upstream server.

+
+

Check the System Status for more information.

+
+ +
+

root@error:~$ curl -I upstream_host

+

HTTP/1.1 502 Bad Gateway

+

© XRock - Just Signal.

+
+
+ + + + \ No newline at end of file diff --git a/errorpage/html/503.html b/errorpage/html/503.html new file mode 100644 index 0000000..7d618ab --- /dev/null +++ b/errorpage/html/503.html @@ -0,0 +1,39 @@ + + + + + + + 503 // Service Unavailable + + + + + + + +
+
+

503

+

> Service Unavailable / System Failure.

+
+ +
+ +
+

./error_message

+

The server is currently unable to handle the request due to maintenance or overload.

+
+

Check the System Status for more information.

+
+ +
+

root@error:~$ systemctl start service

+

Job for service failed because the control process exited with error code.

+

© XRock - Just Signal.

+
+
+ + + + \ No newline at end of file diff --git a/errorpage/html/504.html b/errorpage/html/504.html new file mode 100644 index 0000000..e24a8a4 --- /dev/null +++ b/errorpage/html/504.html @@ -0,0 +1,39 @@ + + + + + + + 504 // Gateway Timeout + + + + + + + +
+
+

504

+

> Gateway Timeout / System Failure.

+
+ +
+ +
+

./error_message

+

The server did not receive a timely response from the upstream server.

+
+

Check the System Status for more information.

+
+ +
+

root@error:~$ timeout 30s curl upstream

+

curl: (28) Operation timed out after 30001 milliseconds with 0 bytes received

+

© XRock - Just Signal.

+
+
+ + + + \ No newline at end of file diff --git a/errorpage/html/assets/css/style.css b/errorpage/html/assets/css/style.css new file mode 100644 index 0000000..0aff0d2 --- /dev/null +++ b/errorpage/html/assets/css/style.css @@ -0,0 +1,167 @@ +/* hidden in a plain sight? */ +:root { + --bg-color: #050505; + --text-color: #e0e0e0; + --accent: #ffffff; + --dim: #666666; + --font-mono: 'Courier New', Courier, monospace; +} + +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + background-color: var(--bg-color); + color: var(--text-color); + font-family: var(--font-mono); + line-height: 1.6; + font-size: 16px; + padding: 2rem; +} + +a { + color: var(--text-color); + text-decoration: none; + border-bottom: 1px solid var(--dim); + transition: all 0.2s; +} + +a:hover { + background-color: var(--text-color); + color: var(--bg-color); + border-color: var(--text-color); +} + +.container { + max-width: 800px; + margin: 0 auto; +} + +/* TEXT */ +h1 { + font-size: 2.5rem; + text-transform: uppercase; + letter-spacing: -2px; + margin-bottom: 0.5rem; +} + +h2 { + font-size: 1.2rem; + margin-bottom: 1.5rem; + border-bottom: 1px solid var(--dim); + display: inline-block; + padding-right: 20px; +} + +.subtitle { + color: var(--dim); + margin-bottom: 2rem; +} + +hr { + border: 0; + border-top: 1px dashed var(--dim); + margin: 2rem 0; +} + +.comment { + color: var(--dim); + font-size: 0.9rem; + margin-left: 10px; +} + +/* SECTIONS */ +section { + margin-bottom: 3rem; +} + +/* LISTS */ +ul { + list-style: none; +} + +.link-list li { + margin-bottom: 0.8rem; + display: flex; + align-items: center; + gap: 15px; +} + +/* STACK GRID */ +.grid-2 { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 2rem; +} + +.skill-item { + display: flex; + justify-content: space-between; + margin-bottom: 0.5rem; +} + +.level { + font-weight: bold; +} + +.special .level { + color: var(--text-color); + text-shadow: 1px 0 0 red, -1px 0 0 blue; +} + +/* my dudes */ +.team-grid { + display: flex; + gap: 2rem; + flex-wrap: wrap; + margin-top: 1rem; +} + +.member { + text-align: center; + width: 100px; +} + +.avatar { + width: 80px; + height: 80px; + background-color: #222; + border: 2px solid var(--text-color); + margin: 0 auto 10px auto; + background-size: cover; +} + +/* if no avatar added: */ +.placeholder::before { + content: "?"; + display: flex; + align-items: center; + justify-content: center; + height: 100%; + font-size: 2rem; + color: var(--dim); +} + +/* REPOS */ +.repo-list li { + margin-bottom: 1rem; +} + +/* FOOTER */ +footer { + text-align: center; + color: var(--dim); + font-size: 0.8rem; +/* flag{why-are-you-here?} */ + margin-top: 4rem; +} +/* SMTH RESPONSIVE */ +@media (max-width: 600px) { + .grid-2 { + grid-template-columns: 1fr; + gap: 0; + } +} From 95f0afbbeea20a46f98264baab9f726bb09295f7 Mon Sep 17 00:00:00 2001 From: mr-forust Date: Wed, 21 Jan 2026 20:14:02 +0100 Subject: [PATCH 2/2] feat: add traefik integration for error-handler TODO: fix css --- {errorpage => errorpages}/Dockerfile | 0 {errorpage => errorpages}/compose.yaml | 6 +++--- {errorpage => errorpages}/html/403.html | 2 +- {errorpage => errorpages}/html/404.html | 2 +- {errorpage => errorpages}/html/500.html | 2 +- {errorpage => errorpages}/html/502.html | 2 +- {errorpage => errorpages}/html/503.html | 2 +- {errorpage => errorpages}/html/504.html | 2 +- .../html/assets/css => errorpages/html}/style.css | 0 traefik/compose.yaml | 12 ++++++------ 10 files changed, 15 insertions(+), 15 deletions(-) rename {errorpage => errorpages}/Dockerfile (100%) rename {errorpage => errorpages}/compose.yaml (89%) rename {errorpage => errorpages}/html/403.html (95%) rename {errorpage => errorpages}/html/404.html (95%) rename {errorpage => errorpages}/html/500.html (95%) rename {errorpage => errorpages}/html/502.html (95%) rename {errorpage => errorpages}/html/503.html (95%) rename {errorpage => errorpages}/html/504.html (95%) rename {errorpage/html/assets/css => errorpages/html}/style.css (100%) diff --git a/errorpage/Dockerfile b/errorpages/Dockerfile similarity index 100% rename from errorpage/Dockerfile rename to errorpages/Dockerfile diff --git a/errorpage/compose.yaml b/errorpages/compose.yaml similarity index 89% rename from errorpage/compose.yaml rename to errorpages/compose.yaml index c0c0783..bac9dc2 100644 --- a/errorpage/compose.yaml +++ b/errorpages/compose.yaml @@ -1,9 +1,9 @@ services: errorpage: build: . - container_name: error-page - # ports: - # - 80 + container_name: error-pages + ports: + - 1234:80 networks: - proxy labels: diff --git a/errorpage/html/403.html b/errorpages/html/403.html similarity index 95% rename from errorpage/html/403.html rename to errorpages/html/403.html index a9db107..2d730da 100644 --- a/errorpage/html/403.html +++ b/errorpages/html/403.html @@ -7,7 +7,7 @@ 403 // Forbidden - + diff --git a/errorpage/html/404.html b/errorpages/html/404.html similarity index 95% rename from errorpage/html/404.html rename to errorpages/html/404.html index e766bae..8681609 100644 --- a/errorpage/html/404.html +++ b/errorpages/html/404.html @@ -7,7 +7,7 @@ 404 // Not Found - + diff --git a/errorpage/html/500.html b/errorpages/html/500.html similarity index 95% rename from errorpage/html/500.html rename to errorpages/html/500.html index 8d66073..c596689 100644 --- a/errorpage/html/500.html +++ b/errorpages/html/500.html @@ -7,7 +7,7 @@ 500 // Server Error - + diff --git a/errorpage/html/502.html b/errorpages/html/502.html similarity index 95% rename from errorpage/html/502.html rename to errorpages/html/502.html index 9df57c1..58802cb 100644 --- a/errorpage/html/502.html +++ b/errorpages/html/502.html @@ -7,7 +7,7 @@ 502 // Bad Gateway - + diff --git a/errorpage/html/503.html b/errorpages/html/503.html similarity index 95% rename from errorpage/html/503.html rename to errorpages/html/503.html index 7d618ab..aa4735a 100644 --- a/errorpage/html/503.html +++ b/errorpages/html/503.html @@ -7,7 +7,7 @@ 503 // Service Unavailable - + diff --git a/errorpage/html/504.html b/errorpages/html/504.html similarity index 95% rename from errorpage/html/504.html rename to errorpages/html/504.html index e24a8a4..0916b8e 100644 --- a/errorpage/html/504.html +++ b/errorpages/html/504.html @@ -7,7 +7,7 @@ 504 // Gateway Timeout - + diff --git a/errorpage/html/assets/css/style.css b/errorpages/html/style.css similarity index 100% rename from errorpage/html/assets/css/style.css rename to errorpages/html/style.css diff --git a/traefik/compose.yaml b/traefik/compose.yaml index 5cf8e38..bf740e0 100644 --- a/traefik/compose.yaml +++ b/traefik/compose.yaml @@ -17,10 +17,11 @@ services: # EntryPoints - "--entryPoints.web.address=:80" - - "--entryPoints.websecure.address=:443" - - "--entryPoints.websecure.http.tls=true" - - "--entryPoints.web.http.redirections.entryPoint.to=websecure" + # - "--entryPoints.web.http.middlewares=error-pages@docker" - "--entryPoints.web.http.redirections.entryPoint.scheme=https" + - "--entryPoints.websecure.address=:443" + - "--entryPoints.websecure.http.middlewares=error-pages@docker" + - "--entryPoints.websecure.http.tls=true" - "--entryPoints.ssh.address=:2221" # Let's Encrypt @@ -34,7 +35,6 @@ services: # Cloudflare - "--entryPoints.web.forwardedHeaders.trustedIPs=173.245.48.0/20,103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,141.101.64.0/18,108.162.192.0/18,190.93.240.0/20,188.114.96.0/20,197.234.240.0/22,198.41.128.0/17,162.158.0.0/15,104.16.0.0/13,104.24.0.0/14,172.64.0.0/13,131.0.72.0/22" - "--entryPoints.websecure.forwardedHeaders.trustedIPs=173.245.48.0/20,103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,141.101.64.0/18,108.162.192.0/18,190.93.240.0/20,188.114.96.0/20,197.234.240.0/22,198.41.128.0/17,162.158.0.0/15,104.16.0.0/13,104.24.0.0/14,172.64.0.0/13,131.0.72.0/22" - # # Logging # - "--log.level=INFO" # - "--log.filePath=/var/log/traefik/traefik.log" @@ -59,7 +59,7 @@ services: # Dev Router - "traefik.http.routers.traefik-dashboard-dev.rule=Host(`traefik.gigaforust.internal`)" - "traefik.http.routers.traefik-dashboard-dev.entrypoints=websecure" - - "traefik.http.routers.traefik-dashboard-dev.middlewares=security-chain@file" + - "traefik.http.routers.traefik-dashboard-dev.middlewares=security-headers@file" - "traefik.http.routers.traefik-dashboard-dev.service=api@internal" - "traefik.http.routers.traefik-dashboard-dev.tls=true" @@ -80,4 +80,4 @@ services: - proxy networks: proxy: - external: true \ No newline at end of file + external: true