Created
February 15, 2021 22:39
-
-
Save mig5/84020f337a43fc8f3104e654e6104b6d to your computer and use it in GitHub Desktop.
This file contains 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
# upptime.js: | |
const express = require('express'); | |
const { createProxyMiddleware } = require('http-proxy-middleware'); | |
const app = express(); | |
app.use('/status-board/Mydex', createProxyMiddleware({ | |
target: 'https://raw.githubusercontent.com', | |
changeOrigin: true, | |
pathRewrite: {['^/status-board/']: '/'}, | |
onProxyReq(proxyReq, req, res) { | |
proxyReq.setHeader('Authorization', 'Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); | |
} | |
})); | |
app.use('/status-board/repos', createProxyMiddleware({ | |
target: 'https://api.github.com', | |
changeOrigin: true, | |
pathRewrite: {['^/status-board/']: '/'}, | |
onProxyReq(proxyReq, req, res) { | |
proxyReq.setHeader('Authorization', 'Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); | |
} | |
})); | |
app.listen(3000, () => { | |
console.log('Server listening on port ', 3000); | |
}); | |
# Nginx vhost | |
server { | |
listen 443; | |
server_name uptime.mixcic.net; | |
ssl on; | |
ssl_certificate /etc/nginx/ssl/uptime.mixcic.net.crt; | |
ssl_certificate_key /etc/nginx/ssl/uptime.mixcic.net.key; | |
error_log /var/log/nginx/uptime.log debug; | |
# Session resumption | |
ssl_session_cache shared:SSL:10m; | |
ssl_session_timeout 10m; | |
location / { | |
allow 10.42.0.11; | |
deny all; | |
proxy_pass http://127.0.0.1:3000; | |
} | |
} | |
# .upptimerc.yml | |
status-website: | |
# Uncomment the following line if you don't have a custom domain and add your repo name | |
# baseUrl: /upptime | |
apiBaseUrl: https://uptime.mixcic.net/status-board |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment