初識Well-Known URI

看NGINX配置SAMPLE時看到這樣一個BLOCK:

# Allow "Well-Known URIs" as per RFC 5785
    location ~* ^/.well-known/ {
        allow all;
    }

聯想到之前使用Let’s Encrypt SSL 證書的時候也有添加一個路徑配置是.well-known的,Y.Cheung 好奇這個路徑究竟有什麼用。

在「RFC5785」中描述如下:

A well-known URI is a URI [RFC3986] whose path component begins with the characters "/.well-known/", and whose scheme is "HTTP", "HTTPS", or another scheme that has explicitly been specified to use well- known URIs.

Applications that wish to mint new well-known URIs MUST register them, following the procedures in Section 5.1.

For example, if an application registers the name 'example', the corresponding well-known URI on 'http://www.example.com/' would be 'http://www.example.com/.well-known/example'.

Registered names MUST conform to the segment-nz production in [RFC3986].

Note that this specification defines neither how to determine the authority to use for a particular context, nor the scope of the metadata discovered by dereferencing the well-known URI; both should be defined by the application itself.

Typically, a registration will reference a specification that defines the format and associated media type to be obtained by dereferencing the well-known URI.