Merge branch 'main' into rust-api

This commit is contained in:
spiral
2023-03-18 23:20:40 -04:00
committed by GitHub
35 changed files with 727 additions and 155 deletions

View File

@@ -25,20 +25,15 @@ func proxyTo(host string) *httputil.ReverseProxy {
// todo: this shouldn't be in this repo
var remotes = map[string]*httputil.ReverseProxy{
"api.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:202]:5000"),
"dash.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:202]:8080"),
"sentry.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:202]:9000"),
"api.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:902]:5000"),
"dash.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:902]:8080"),
"sentry.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:902]:9000"),
"grafana.pluralkit.me": proxyTo("[fdaa:0:ae33:a7b:8dd7:0:a:802]:3000"),
}
type ProxyHandler struct{}
func (p ProxyHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
if r.Header.Get("User-Agent") == "" {
// please set a valid user-agent
rw.WriteHeader(403)
return
}
remote, ok := remotes[r.Host]
if !ok {
// unknown domains redirect to landing page