Freika / dawarich

Self-hosted alternative to Google Location History (Google Maps Timeline)
https://dawarich.app
GNU Affero General Public License v3.0
740 stars 15 forks source link

Cannot login if I'm using HTTPS #106

Closed ldellisola closed 1 week ago

ldellisola commented 2 weeks ago

I am running the current version of Dawarich in my home server behind a Traefik reverse proxy.

I can access the login page without any problem but I cannot login if I'm using an HTTPS connection. If I use HTTP under the same reverse proxy, I can log in without any issues.

Here's the error:

Screenshot 2024-07-07 at 18 41 11

(The hosts under the black boxes are identical)

This is my docker-compose.yaml:

networks:
  dawarich:
  web:
    name: "web"
    external: true

services:
  redis:
    image: redis:7.0-alpine
    command: redis-server
    restart: unless-stopped
    volumes:
      - ./redis:/var/shared/redis
    networks:
      - dawarich
  postgres:
    image: postgres:14.2-alpine
    restart: unless-stopped
    volumes:
      - ./db:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: ...
      POSTGRES_PASSWORD: ...
    networks:
      - dawarich
  app:
    image: freikin/dawarich:latest
    volumes:
      - ./app/gems:/usr/local/bundle/gems
      - ./app/public:/var/app/public
    stdin_open: true
    tty: true
    entrypoint: dev-entrypoint.sh
    command: ['bin/dev']
    restart: unless-stopped
    networks:
      - web
      - dawarich
    environment:
      RAILS_ENV: development
      REDIS_URL: redis://redis:6379/0
      DATABASE_HOST: postgres
      DATABASE_USERNAME:...
      DATABASE_PASSWORD: ...
      DATABASE_NAME: dawarich
      MIN_MINUTES_SPENT_IN_CITY: 60
      APPLICATION_HOST: <MY-HOST>
      TIMEZONE: Europe/Oslo
    depends_on:
      - postgres
      - redis
    labels:
      traefik.enable: "true"
      traefik.http.routers.dawarich.rule: "Host(`<MY-HOST>`)"
      traefik.http.services.dawarich.loadbalancer.server.port: "3000"

  sidekiq:
    image: freikin/dawarich:latest
    volumes:
      - ./app/gems:/usr/local/bundle/gems
      - ./app/public:/var/app/public
    stdin_open: true
    tty: true
    entrypoint: dev-entrypoint.sh
    command: ['sidekiq']
    restart: unless-stopped
    networks:
      - dawarich
    environment:
      RAILS_ENV: development
      REDIS_URL: redis://redis:6379/0
      DATABASE_HOST: postgres
      DATABASE_USERNAME: ...
      DATABASE_PASSWORD: ...
      DATABASE_NAME: dawarich
      APPLICATION_HOST: <MY-HOST>
      BACKGROUND_PROCESSING_CONCURRENCY: 10
    depends_on:
      - app
      - redis
      - postgres
Freika commented 2 weeks ago

Hi @ldellisola You can try setting it in APPLICATION_PROTOCOL env var, it was implemented in 0.8.4 release: https://github.com/Freika/dawarich/releases/tag/0.8.4

ldellisola commented 2 weeks ago

Hey, When I set APPLICATION_PROTOCOL to https the site goes into an infinite redirect when I try to access the site:

Screenshot 2024-07-09 at 07-11-39 Problem loading page

This happens not matter if I have https redirection enabled or disabled in my reverse proxy.

Freika commented 1 week ago

Unfortunately, I can't provide support with Traefik as I don't use it.

For Caddy, though, my configuration is working and looks like this:

dawarich.myhost.com {
    reverse_proxy 192.168.0.1:3000
    tls {
        dns cloudflare CLOUDFLARE_API_KEY
    }
}

I'm accessing it using Tailscale + Cloudflare SSL certificates, I described my setup in details here: https://frey.today/homelab-with-tailscale-docker-caddy-ssl-cloudflare/

ldellisola commented 1 week ago

Weird. I'll look on my end then. Thanks anyway!