-
Notifications
You must be signed in to change notification settings - Fork 2
Location Selection
The location directive allows to route request to the correct location within the file system. The directive is used to tell where to look for a resource by including files and folders while matching a location block against an URI.
The location block will be placed within a server block. The nginx location block works with a modifier, which our webserv does not do. The syntax of our location block is:
location [URI] {
...
}
The location block will match any request starting with what is defined in [URI]
. If multiple location blocks match the URI, the longest match will be chosen. For example:
Requested URI: /hello.txt
location / {
}
location /hey {
}
location /hello {
}
location /hello.t {
}
The location blocks 1 3 and 4 all match, but as 4 has the longest match, this will be the location block that will handle the request.
Webserv Wiki
Project
Configuration File
HTTP Headers
Documentation
Network Programming
HTTP Information
RFC highlights
Resources