Skip to content

[BUG] swag-ondemand loading page doesn't worth with Cloudflare and Authelia #1084

@pbaylas

Description

@pbaylas

Is there an existing issue for this?

  • I have searched the existing issues

Name of mod

swag-ondemand

Name of base container

swag

Current Behavior

I spotted that @quietsy has found, and merged, the same fix I found for the issue with the swag-ondemand loading page not working with Cloudflare. (see #1083)

However, even with that fix, I'm still getting Cloudflare's generic 502 error page when swag_auth=authelia is also set on the endpoint. Looking at the access logs it's redirecting back to the same url after auth, so it seems like it should work fine, but it's not. 😕

Expected Behavior

I would expect the loading page to show after the redirect back from the auth provider.

Btw, thanks for making this mod! I was thinking about setting something similar up with a separate package and this came along at the perfect time and works beautifully (aside from this small bug)!

Steps To Reproduce

  1. See docker compose below

Environment

- OS: Ubuntu 24.04.3
- How docker service was installed: Docker's apt repository

CPU architecture

x86-64

Docker creation

services:
  nginx:
    image: lscr.io/linuxserver/nginx:latest
    container_name: redacted
    networks:
      - swag
    environment:
      PUID: ${PUID}
      PGID: ${PGID}
      TZ: ${TIMEZONE}
    volumes:
      - ./config:/config
      - /media/library/archive/redacted:/config/www
    restart: unless-stopped
    labels:
      - swag=enable
      - swag_url=sub.${DOMAIN_NAME}
      - swag_port=80
      - swag_auth=authelia
      - swag_ondemand=enable
      - swag_server_custom_directive=include /config/nginx/ondemand.conf;
      - swag_ondemand_urls=https://sub.
networks:
  swag:
    external: true

Container logs

REDACTED - - [25/Nov/2025:12:42:16 +0000] "GET https://sub.domain.net/ HTTP/1.1" 302 138 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:16 +0000] "GET https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET HTTP/1.1" 200 1131 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:16 +0000] "GET https://auth.domain.net/static/css/index.ChexMFeY.css HTTP/1.1" 304 0 "https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:16 +0000] "GET https://auth.domain.net/locales/en/consent.json HTTP/1.1" 200 2524 "https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:16 +0000] "GET https://auth.domain.net/locales/en/settings.json HTTP/1.1" 200 11918 "https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:16 +0000] "GET https://auth.domain.net/locales/en/portal.json HTTP/1.1" 200 7938 "https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:16 +0000] "GET https://auth.domain.net/locales/en-GB/portal.json HTTP/1.1" 200 2 "https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:16 +0000] "GET https://auth.domain.net/locales/en-GB/consent.json HTTP/1.1" 200 2 "https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:16 +0000] "GET https://auth.domain.net/locales/en-GB/settings.json HTTP/1.1" 200 2 "https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:16 +0000] "GET https://auth.domain.net/favicon.ico HTTP/1.1" 304 0 "https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:16 +0000] "GET https://auth.domain.net/api/state HTTP/1.1" 200 142 "https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:16 +0000] "GET https://auth.domain.net/api/configuration HTTP/1.1" 200 129 "https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:16 +0000] "POST https://auth.domain.net/api/checks/safe-redirection HTTP/1.1" 200 34 "https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:16 +0000] "POST https://auth.domain.net/api/user/info HTTP/1.1" 200 130 "https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:17 +0000] "POST https://auth.domain.net/api/checks/safe-redirection HTTP/1.1" 200 34 "https://auth.domain.net/?rd=https%3A%2F%2Fsub.domain.net%2F&rm=GET" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:17 +0000] "GET https://sub.domain.net/ HTTP/1.1" 502 150 "https://auth.domain.net/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:17 +0000] "GET https://sub.domain.net/ HTTP/1.1" 502 150 "https://auth.domain.net/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"
REDACTED - - [25/Nov/2025:12:42:17 +0000] "GET https://sub.domain.net/favicon.ico HTTP/1.1" 502 150 "https://sub.domain.net/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions