[GH-ISSUE #981] Unable to use different domains for web GUI and pings? #685

Closed
opened 2026-02-25 23:43:16 +03:00 by kerem · 2 comments
Owner

Originally created by @pro-sumer on GitHub (Mar 27, 2024).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/981

Until recently I was using the single domain old.domain.tld for both the web GUI and for pings, but now I want to split this up:

  • new.domain.tld for the web GUI
  • old.domain.tld for the pings (so I don't have to update any of my scripts)

This is what I'm trying:

Caddyfile:

old.domain.tld {
  import cloudflare

  reverse_proxy /ping/* healthchecks_web:8000
  redir https://new.domain.tld{uri}
}

new.domain.tld {
  import cloudflare

  reverse_proxy healthchecks_web:8000
}

.env.production:

ALLOWED_HOSTS=new.domain.tld,old.domain.tld
SITE_ROOT=https://new.domain.tld
PING_ENDPOINT=https://old.domain.tld/ping/

This works:

  • webGUI is available on new.domain.tld
  • when I accidentally surf to old.domain.tld this get redirected to new.domain.tld

This fails:

  • all of my pings no longer work with this setup

What am I doing wrong?

Originally created by @pro-sumer on GitHub (Mar 27, 2024). Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/981 Until recently I was using the single domain _old.domain.tld_ for both the web GUI and for pings, but now I want to split this up: * _new.domain.tld_ for the web GUI * _old.domain.tld_ for the pings (so I don't have to update any of my scripts) This is what I'm trying: **Caddyfile**: ``` old.domain.tld { import cloudflare reverse_proxy /ping/* healthchecks_web:8000 redir https://new.domain.tld{uri} } new.domain.tld { import cloudflare reverse_proxy healthchecks_web:8000 } ``` **.env.production**: ``` ALLOWED_HOSTS=new.domain.tld,old.domain.tld SITE_ROOT=https://new.domain.tld PING_ENDPOINT=https://old.domain.tld/ping/ ``` This works: * webGUI is available on _new.domain.tld_ * when I accidentally surf to _old.domain.tld_ this get redirected to _new.domain.tld_ This fails: * all of my pings no longer work with this setup What am I doing wrong?
kerem closed this issue 2026-02-25 23:43:16 +03:00
Author
Owner

@cuu508 commented on GitHub (Mar 28, 2024):

Where are the ping requests landing? Do you see them in healthchecks_web container's logs?

<!-- gh-comment-id:2024630585 --> @cuu508 commented on GitHub (Mar 28, 2024): Where are the ping requests landing? Do you see them in healthchecks_web container's logs?
Author
Owner

@pro-sumer commented on GitHub (Mar 28, 2024):

Figured it out thanks to this post:

The issue you’re running into is that Caddy sorts directives according to this predetermined directive order (redir gets sorted before reverse_proxy)

So this fixes it:

old.domain.tld {
  import cloudflare

  @notPings not path /ping/*
  redir @notPings https://new.domain.tld{uri}
  reverse_proxy healthchecks_web:8000
}
<!-- gh-comment-id:2026212230 --> @pro-sumer commented on GitHub (Mar 28, 2024): Figured it out thanks to [this post](https://caddy.community/t/reverse-proxy-and-redirect-on-same-directive/13087/2): > The issue you’re running into is that Caddy sorts directives according to this predetermined directive order (redir gets sorted before reverse_proxy) So this fixes it: ``` old.domain.tld { import cloudflare @notPings not path /ping/* redir @notPings https://new.domain.tld{uri} reverse_proxy healthchecks_web:8000 } ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/healthchecks#685
No description provided.