feat(api): block empty user-agents
This commit is contained in:
parent
95389e8df8
commit
5da3c84bce
@ -48,6 +48,12 @@ func init() {
|
|||||||
type ProxyHandler struct{}
|
type ProxyHandler struct{}
|
||||||
|
|
||||||
func (p ProxyHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
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]
|
remote, ok := remotes[r.Host]
|
||||||
if !ok {
|
if !ok {
|
||||||
// unknown domains redirect to landing page
|
// unknown domains redirect to landing page
|
||||||
|
Loading…
Reference in New Issue
Block a user