dgtlmoon / changedetection.io

The best and simplest free open source web page change detection, website watcher, restock monitor and notification service. Restock Monitor, change detection. Designed for simplicity - Simply monitor which websites had a text change for free. Free Open source web page change detection, Website defacement monitoring, Price change notification
https://changedetection.io
Apache License 2.0
17.3k stars 965 forks source link

Issues with reverse proxy using swag #162

Closed sudo-kraken closed 3 years ago

sudo-kraken commented 3 years ago

I have the following docker compose yml and conf files set, trying to allow me to access the app on https://domain.com/changedetection but it does not work:

  changedetection.io:
    image: dgtlmoon/changedetection.io
    container_name: changedetection
    hostname: changedetection
    restart: always
    volumes:
      - $DOCKERDIR/changedetectionio:/datastore
    environment:
      PUID: $PUID
      PGID: $PGID
      USE_X_SETTINGS: 1
    ports:
      - "5000:5000"
    networks:
      - proxy_net
location ^~ /changedetection/ {

    include /config/nginx/authelia-location.conf;

    include /config/nginx/proxy.conf;
    resolver 127.0.0.11 valid=30s;
    set $upstream_app changedetection;
    set $upstream_port 5000;
    set $upstream_proto http;
    proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    proxy_set_header X-Forwarded-Prefix /changedetection;       
}

The proxy.conf contains the following

# Timeout if the real server is dead
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;

# Proxy Connection Settings
proxy_buffers 32 4k;
proxy_connect_timeout 240;
proxy_headers_hash_bucket_size 128;
proxy_headers_hash_max_size 1024;
proxy_http_version 1.1;
proxy_read_timeout 240;
proxy_redirect  http://  $scheme://;
proxy_send_timeout 240;

# Proxy Cache and Cookie Settings
proxy_cache_bypass $cookie_session;
#proxy_cookie_path / "/; Secure"; # enable at your own risk, may break certain apps
proxy_no_cache $cookie_session;

# Proxy Header Settings
proxy_set_header Connection $connection_upgrade;
proxy_set_header Early-Data $ssl_early_data;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Real-IP $remote_addr;

This works for all other apps but this one. Please let me know if you have a way to make this work as I dont want this to run on /app

Thanks

dgtlmoon commented 3 years ago

@Joeharrison94 thanks for the report, I cant see what you are seeing on your screen, what exactly do you mean by "but it does not work", do you get an error? whats the error exactly? can you paste it? Does the app load at all?

also your docker-compose.yml does not have any other services listed, so probably the stack is not communicating via network: to it, but i dont know, because you didnt even tell me what the error is, other than 'it doesnt work'

sudo-kraken commented 3 years ago

Apologies, all of the containers are in the same network "proxy_net" the app loads as expected on localhost and port number but when access by the domain name it shows error "Not Found The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.." This usually happens when the app doesnt respond to the request.

version: "3.7"

networks:
  proxy_net:
    name: proxy_net
    driver: bridge

  swag:
    container_name: swag
    hostname: swag
    image: ghcr.io/linuxserver/swag
    restart: unless-stopped  
    networks:
      - proxy_net
      - socket_proxy
    ports:
      - 4444:443
    #  - 80:80 #optional
    depends_on:
      - socket-proxy
      - authelia
    cap_add:
      - NET_ADMIN
    volumes:
      - $DOCKERDIR/swag:/config      
    environment:
      PUID: $PUID
      PGID: $PGID
      TZ: $TZ
      URL: $DOMAINNAME
      SUBDOMAINS: wildcard
      VALIDATION: dns
      DNSPLUGIN: cloudflare
      DHLEVEL: 2048
      ONLY_SUBDOMAINS: "false"
      STAGING: "false"
      DOCKER_MODS: linuxserver/mods:swag-cloudflare-real-ip|linuxserver/mods:swag-auto-reload

  # Change Detection io - Checks websites for changes and notifies you
  changedetection.io:
    image: dgtlmoon/changedetection.io
    container_name: changedetection
    hostname: changedetection
    restart: always
    volumes:
      - $DOCKERDIR/changedetectionio:/datastore
    environment:
      PUID: $PUID
      PGID: $PGID
      USE_X_SETTINGS: 1
    ports:
      - "5000:5000"
    networks:
      - proxy_net

  overseerr :
    container_name: overseerr
    restart: unless-stopped
    image: linuxserver/overseerr:latest
    volumes:
      - $DOCKERDIR/requests:/config
    ports:
      - "5055:5055"     
    environment:
      PUID: $PUID
      PGID: $PGID      
      TZ: $TZ
      LOG_LEVEL: info
    networks:
      - proxy_net
    security_opt:
      - no-new-privileges:true

just put a couple of my containers here as m y compose yaml is almost 1000 lines long

sudo-kraken commented 3 years ago

essentially all I want is to be able to go to domain.com/changedetection and have it load up like my other apps, but I havbent come across an issue like this before.

dgtlmoon commented 3 years ago

ok, so basically it's out of my scope to support your custom configuration for free (I write this software in my spare time, when I should be working more and earning better money for paying my rent and food with)

I can only say, maybe is this right? try using the exact setup from https://github.com/dgtlmoon/changedetection.io/wiki/Running-changedetection.io-behind-a-reverse-proxy-sub-directory as this is also using nginx..

location ^~ /changedetection/ {