2 Commits

Author SHA1 Message Date
tueem 4993d6e05d Merge pull request 'Fix scheme determination behind reverse proxies' (#23) from fix/mixed into dev
build / Go-Build (push) Successful in 1m27s
Reviewed-on: #23
2026-05-31 11:16:43 +00:00
tueem 8906cd9678 fix(download): fix scheme determination behind reverse proxies
build / Go-Build (push) Successful in 1m29s
build / Go-Build (pull_request) Successful in 1m30s
2026-05-31 13:12:57 +02:00
5 changed files with 18 additions and 26 deletions
+2 -4
View File
@@ -3,10 +3,8 @@ name: build
on: on:
pull_request: pull_request:
push: push:
branches: branches-ignore:
- '**' - main
tags:
- '**'
jobs: jobs:
Go-Build: Go-Build:
+2 -2
View File
@@ -2,8 +2,8 @@ name: docker
on: on:
push: push:
tags: branches:
- '**' - 'main'
jobs: jobs:
docker: docker:
+1 -3
View File
@@ -16,6 +16,4 @@ RUN apt update && apt install -y curl tar \
&& mv resvg /usr/local/bin/resvg \ && mv resvg /usr/local/bin/resvg \
&& chmod +x /usr/local/bin/resvg && chmod +x /usr/local/bin/resvg
COPY --from=builder /app/svg-templater /usr/local/bin/svg-templater COPY --from=builder /app/svg-templater /usr/local/bin/svg-templater
COPY entrypoint.sh /entrypoint.sh CMD ["svg-templater"]
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
-13
View File
@@ -1,13 +0,0 @@
#!/bin/sh
CMD="svg-templater"
if [ -n "$API_KEY" ]; then
CMD="$CMD --frontendkey $API_KEY"
fi
if [ -n "$DATA_DIR" ]; then
CMD="$CMD --data $DATA_DIR"
fi
eval exec $CMD "$@"
+13 -4
View File
@@ -104,9 +104,18 @@ func getPublicUrl(r *http.Request, subpath string) string {
Host: r.Host, Host: r.Host,
Path: path.Join("public", subpath), Path: path.Join("public", subpath),
} }
newURL.Scheme = "http" newURL.Scheme = determineScheme(r)
if r.TLS != nil {
newURL.Scheme = "https"
}
return newURL.String() return newURL.String()
} }
func determineScheme(r *http.Request) string {
if proto := r.Header.Get("X-Forwarded-Proto"); proto != "" {
return proto
}
if r.TLS != nil {
return "https"
}
return "http"
}