cleanup console & landing page

This commit is contained in:
2025-08-23 10:15:48 +02:00
parent 75355c43a8
commit 7251753df5
8 changed files with 74 additions and 35 deletions

View File

@@ -23,15 +23,13 @@ RUN git clone https://github.com/varnish/libvmod-digest.git /opt/libvmod-digest
COPY --from=hairyhenderson/gomplate:stable /gomplate /bin/gomplate
ARG HASS_HOST
ARG FRONTEND_HOST
ENV HASS_HOST=$HASS_HOST
ENV FRONTEND_HOST=$FRONTEND_HOST
COPY default.vcl.tmpl /etc/varnish/
COPY *.vcl /etc/varnish/
COPY includes /etc/varnish/includes
ARG PROXY_HOST=$PROXY_HOST
ARG IMAGE_HOST=$IMAGE_HOST
RUN gomplate -f /etc/varnish/default.vcl.tmpl -o /etc/varnish/default.vcl
RUN rm /etc/varnish/default.vcl.tmpl

View File

@@ -2,18 +2,19 @@ vcl 4.0;
import std;
import digest;
import directors;
include "includes/x-cache-header.vcl";
include "vcl_deliver.vcl";
# Define backend pointing to Home Assistant IP
backend hass_backend {
.host = "{{ getenv `HASS_HOST` `homeassistant.local` }}";
.host = "{{ getenv `IMAGE_HOST` `homeassistant.local` }}";
.port = "8123";
}
backend app_frontend {
.host = "{{ getenv `FRONTEND_HOST` `localhost` }}";
.host = "{{ getenv `PROXY_HOST` `localhost` }}";
.port = "3000";
}
@@ -45,6 +46,17 @@ sub vcl_recv {
unset req.http.Cookie;
}
// Svelte-kit needs to distinguish between it's own files and the Host header.
// The X-Forwarded-* headers below are to tell svelte-kit where it's local files are,
// and the Host header is included in the returned html & js referencing the external
// domain or proxy requested by client.
// https://svelte.dev/docs/kit/adapter-node#Environment-variables-ORIGIN-PROTOCOL_HEADER-HOST_HEADER-and-PORT_HEADER
sub vcl_backend_fetch {
set bereq.http.X-Forwarded-Host = "localhost";
set bereq.http.X-Forwarded-Port = "3000";
set bereq.http.X-Forwarded-Proto = "http";
}
sub vcl_synth {
if (resp.status == 204) {
set resp.http.Access-Control-Allow-Origin = "*";