fix: check X-Forwarded-Proto for https detection

This commit is contained in:
Evan Fiordeliso 2023-08-16 15:17:22 -04:00
parent b535db6108
commit 94b2851984
2 changed files with 4 additions and 5 deletions

View File

@ -3,9 +3,8 @@ name: "Test"
# yamllint disable-line rule:truthy # yamllint disable-line rule:truthy
on: on:
{} pull_request:
# pull_request: push:
# push:
jobs: jobs:
tests: tests:
@ -19,6 +18,6 @@ jobs:
# extraPullNames: devenv # extraPullNames: devenv
# authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' # authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Install devenv.sh - name: Install devenv.sh
run: nix profile install github:cachix/devenv/latest run: nix-env -if https://github.com/cachix/devenv/tarball/main
- run: devenv shell echo ok - run: devenv shell echo ok
- run: devenv ci - run: devenv ci

View File

@ -31,7 +31,7 @@ func (c *HomeController) Router(r chi.Router) {
func (c *HomeController) Index(w http.ResponseWriter, r *http.Request) { func (c *HomeController) Index(w http.ResponseWriter, r *http.Request) {
hx := htmx.New(w, r) hx := htmx.New(w, r)
isSecure := r.URL.Scheme == "https" isSecure := r.URL.Scheme == "https" || r.Header.Get("X-Forwarded-Proto") == "https"
if hx.IsHtmxRequest() { if hx.IsHtmxRequest() {
hx.PushUrl("/") hx.PushUrl("/")