Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save visualblind/dd5c192856aebfa65739e2b029f65552 to your computer and use it in GitHub Desktop.
Save visualblind/dd5c192856aebfa65739e2b029f65552 to your computer and use it in GitHub Desktop.
NGINX Config for Hacking Cronitor.io Status Page Custom Domain
## AUTHOR: Travis Runyard
## DATE: 06/22/2024
# The reason for this gist is to allow you to use cronitor.io's
# status page on any custom (sub)domain and/or URI you would like.
# Since sites like cronitor.io make the custom domain option
# for their status page a paid expense, there is usually always
# an easy way to either bypass their bullshit or at least step
# around it.
# To see an example of a full site config incorporating this gist:
# https://t.ly/PeC1G
# This uses two core NGINX directives: rewrite and return
# The following assumes that you're using the /status/ URI
# on your custom domain instead of doing custom subdomain.
### Replace <YourCronitorStatusPageName> with your cronitor
### status page name.
### Inside your site server conf:
location /status/ {
proxy_set_header Host <YourCronitorStatusPageName>.cronitorstatus.com;
add_header X-Nginx-ClientIP $remote_addr;
add_header X-Nginx-Proxy $proxy_host;
add_header X-Nginx-Forwarded-Host $http_host;
add_header Strict-Transport-Security "max-age=31536000" always;
proxy_pass https://<YourCronitorStatusPageName>.cronitorstatus.com/;
}
location /_next {
rewrite ^/_next/(.*)$ /status/_next/$1 last;
}
location ~ ^/(api/|history)(.*)?$ {
return 301 /status/$1$2$is_args$args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment