Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • Thanks @SteffenUllrich. Do you know if the correct thing to do is not send back the CORS headers in the case of a Host-mismatch, or should we reject the requests altogether? Commented Jul 12, 2018 at 21:37
  • @MaxGabriel Generally a mismatched Host header indicates either a client error / bug, a DNS error, or a malicious request. It's perfectly reasonable to return HTTP 400 (with no CORS headers) in that case, or even just close the connection without responding at all. A legit client might try connecting by IP rather than hostname, but this is essentially never done for HTTPS (it'll result in cert errors) and in any case doesn't work on multi-tenant servers, so it's generally fine to not support this case. That's especially true when the only expected client is running your own code! Commented Jul 12, 2018 at 23:05