more hints for invalid config

This commit is contained in:
ed 2025-11-20 00:26:44 +09:00
parent 7d62335c13
commit c424a55d6f

View file

@ -785,7 +785,7 @@ class HttpCli(object):
guess = "modifying" if (origin and host) else "stripping" guess = "modifying" if (origin and host) else "stripping"
t = "cors-reject %s because request-header Origin=%r does not match request-protocol %r and host %r based on request-header Host=%r (note: if this request is not malicious, check if your reverse-proxy is accidentally %s request headers, in particular 'Origin', for example by running copyparty with --ihead='*' to show all request headers)" t = "cors-reject %s because request-header Origin=%r does not match request-protocol %r and host %r based on request-header Host=%r (note: if this request is not malicious, check if your reverse-proxy is accidentally %s request headers, in particular 'Origin', for example by running copyparty with --ihead='*' to show all request headers)"
self.log(t % (self.mode, origin, proto, self.host, host, guess), 3) self.log(t % (self.mode, origin, proto, self.host, host, guess), 3)
raise Pebkac(403, "rejected by cors-check") raise Pebkac(403, "rejected by cors-check (see serverlog)")
# getattr(self.mode) is not yet faster than this # getattr(self.mode) is not yet faster than this
if self.mode == "POST": if self.mode == "POST":
@ -931,7 +931,7 @@ class HttpCli(object):
return False return False
self.log("banned for {:.0f} sec".format(rt), 6) self.log("banned for {:.0f} sec".format(rt), 6)
self.terse_reply(b"thank you for playing", 403) self.terse_reply(b"thank you for playing (see serverlog and readme)", 403)
return True return True
def permit_caching(self) -> None: def permit_caching(self) -> None: