feat(api): block empty user-agents

This commit is contained in:
spiral 2023-02-15 12:58:59 -05:00
parent 95389e8df8
commit 5da3c84bce

View File

@ -48,6 +48,12 @@ func init() {
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