Forcing URLs to lower case example

Jeffrey Walton noloader at gmail.com
Thu Mar 7 19:59:02 UTC 2024


On Thu, Mar 7, 2024 at 1:54 PM Victor Oppenheimer <victor at camb.com> wrote:
>
> I am using nginx on MS Windows primarily for reverse proxying.
>
> I would like to force URLs reaching nginx into lower case before further
> processing in my nginx.configfile.
>
> That is, I'd like subsequent server and/or location directives to all
> receive lower case versions of URLs being processed regardless of the
> case mixture of the original URL.
>
> Is this possible?  If so I'd appreciate a link to the relevant
> documentation and perhaps examples.  If not, how close can I come to
> making nginx on windows case independent?

Related, that may not be a good idea. The scheme and host part of a
URL is not case sensitive. However, the remaining path and query of
the URL might be case sensitive. Whether the remaining parts are
case-sensitive depends on the scheme.

RFC 3986, Section 6.2.2.1, Case Normalization:

   For all URIs, the hexadecimal digits within a percent-encoding
   triplet (e.g., "%3a" versus "%3A") are case-insensitive and therefore
   should be normalized to use uppercase letters for the digits A-F.

   When a URI uses components of the generic syntax, the component
   syntax equivalence rules always apply; namely, that the scheme and
   host are case-insensitive and therefore should be normalized to
   lowercase.  For example, the URI <HTTP://www.EXAMPLE.com/> is
   equivalent to <http://www.example.com/>.  The other generic syntax
   components are assumed to be case-sensitive unless specifically
   defined otherwise by the scheme (see Section 6.2.3).

Jeff


More information about the nginx mailing list