Question: Are there some error events / codes that NGINX handles by default?
Background: The following portion of my config stops hotlinking and returns a 403 error.
location ~* \.(jpg|png|svg|webp|ico)$ {
valid_referers none blocked server_names ~\.bing\. ~\.duckduckgo\. ~\.facebook\. ~\.google\. ~\.instagram\. ~\.twitter\. ~\.yahoo\.;
if ($invalid_referer) {
return 403;
}
}
This section blocks unwanted HTTP methods and returns a 405 error.
if ($request_method !~ ^(GET|HEAD|POST)$) {
return 405;
}
This got me thinking, are there any errors that I don't have to set up in NGINX?
For example, a 400 Bad Request error. Does NGINX know what a bad request is without adding an if
statement and some logic to the config?
Alternately do I need to set up every error in the config that I plan to use and if I don't it can't be triggered? I always assumed this was the case but when I see how many different 400 and 500 errors there are I wonder if I'm not fully understanding this concept.