Last active
July 25, 2024 18:11
-
-
Save visualblind/dd5c192856aebfa65739e2b029f65552 to your computer and use it in GitHub Desktop.
NGINX Config for Hacking Cronitor.io Status Page Custom Domain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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