uptime-kuma: Reverse proxy broken (`ERR_TOO_MANY_REDIRECTS 308` on Chrome)

Is it a duplicate question? Don’t think so.

Describe the bug With the latest louislam/uptime-kuma:1.7.3-alpine docker container, reverse proxy can no longer be used and the following error appears with both caddy and https-portal.

image

By reverting to louislam/uptime-kuma:1.6.0-alpine resolves this issue:

image

To Reproduce Steps to reproduce the behavior:

Run the following docker-compose.yaml file:

version: '3.3'

services:
  https-portal:
    image: steveltn/https-portal:1
    ports:
      - '80:80'
      - '443:443'
    links:
      - uptime-kuma
    restart: always
    environment:
      DOMAINS: 'example.com -> http://uptime-kuma:3001'
      STAGE: 'production' # Don't use production until staging works
      # FORCE_RENEW: 'true'
      WEBSOCKET: 'true'
    volumes:
      - https-portal-data:/var/lib/https-portal

  uptime-kuma:
    image: louislam/uptime-kuma:1.7.3-alpine
    volumes:
      - ./uptime-kuma:/app/data
    ports:
      - 3001:3001

volumes:
  https-portal-data:

Info Uptime Kuma Version: 1.7.3 Using Docker?: Yes Docker Version: 20.10.8 OS: Centos 8 Browser: chrome, safari

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 42 (10 by maintainers)

Most upvoted comments

🤣 A lot of question marks here.

Is that the “:” cause the problem?

Anyway, glad you guys can make it works.

Ok this is kinda weird. I’m running 1.8.0 and it’s working now in Chrome 😆

This is running louislam/uptime-kuma:nightly-trust-proxy. What I did change was remove the “:” character in the Caddyfile from the Wiki, pretty sure that may be a typo:

subdomain.domain.com {
    reverse_proxy 127.0.0.1:3001 : <--- Removed this ":"
}

Restarted Caddy and then cleared my browser’s cache.

@louislam

Yes looks like that is, I think I posted it above. Glad it’s working. I was testing and it started working for me too 😁

For whatever reason, caddy works file and https-portal also worked…

Hmm, not sure what happened, but it seems fine now… LOL

image

app.enable("trust proxy");

http://expressjs.com/zh-tw/api.html#app.enable

I double checked, this line is presented in the container.

Hi @louislam

Both images louislam/uptime-kuma:nightly-node-14.17.6 and louislam/uptime-kuma:nightly-no-dumb-init have the same issue.

Now i could not reproduce your issue directly, now I am not to familiar with docker, but could this be an issue with docker alpine it self?

No, because @vwxyzjn had tried 1.7.3 which is Debian base.

image

It’s fine… I didn’t even change any configuration.

No worries, hopefully I can test later this evening and I’ll report back o7 😄

Since @vwxyzjn is ok with 1.7.0, I try to build images that reverted some important change.

@vwxyzjn @dbrennand would you able to try?

Older Node 14 (14.17.6) louislam/uptime-kuma:nightly-node-14.17.6

No dumb-init louislam/uptime-kuma:nightly-no-dumb-init

Is Uptime-Kuma also using Express.js as the web app framework

Yes, it is express.js. I will try to build this too tomorrow.

Hi,

Hmmm this issue is interesting.

I’m using Caddy and uptime-kuma docker images and I’m also experiencing this issue only with Chromium based browsers. This isn’t the first time I’ve had issues with net::ERR_TOO_MANY_REDIRECTS 308 when using Caddy to reverse proxy to applications and access them using Chrome.

I experienced a similar issue with Planka and now again with Uptime-Kuma… 🤔

Is Uptime-Kuma also using Express.js as the web app framework? If so, I think I resolved my issue with Planka by enabling the trust proxy. However, as stated in my issue for Planka, I was never quite sure if that solved the issue.

Caddy version: 2.4.5 Uptime-Kuma version: 1.8.0-debian

My docker-compose.yaml file:

version: "3"
services:
  caddy:
    image: caddy:2.4.5
    container_name: caddy
    network_mode: host
    volumes:
      - caddy-data:/data
      # Mount Caddyfile
      - ./caddy/Caddyfile:/etc/caddy/Caddyfile
    environment:
      - ACME_EMAIL=
    restart: always
  uptime-kuma:
    image: louislam/uptime-kuma:1.8.0-debian
    container_name: uptime-kuma
    ports:
      - "127.0.0.1:3001:3001"
    volumes:
      - uptime-kuma:/app/data
    restart: unless-stopped

volumes:
  caddy-data:
  uptime-kuma:

Caddyfile:

{
    email {env.ACME_EMAIL}
}
...
uptime.net.domain.tld {
    reverse_proxy localhost:3001 :
}
...

So after EXTENSIVE trying I was able to get the issue to reproduce using both caddy and Https-portal. (still not sure how I reproduced it exactly but I did, I will try to document how I reproduced it later on) Here is where it gets weird, if I press CTRL + Shit + R on the white page it loads the page normally and actually redirects properly. I also have no issues if I open the url in Firefox. @vwxyzjn are you able to try either of those?

@vwxyzjn By any chance did you configure caddy with logging? If so could you post your log file and cady config file if possible? Will help me troubleshoot the issue.

Not sure what happen, I cannot reproduce. As there is no redirect logic in Uptime Kuma, I assume it is not an Uptime Kuma problem.

I have an may idea of what the problem may be. I think it’s related to caddy. I will debug and run some tests when I get home.