Community Patterns

Community Library Entry

0

Regular Expression
Created·2023-06-28 14:55
Flavor·PCRE2 (PHP)

/
^(?<m>[^\?]+)\?(?:.*)?
/
gm
Open regex in editor

Description

Regular expression used to get the encoded URI portion of the $request_uri when unencoded $uri breaks a reverse proxy.

map $request_uri $request_uri_no_qs {
  "~^(?<m>[^\?]+)\?(?:.*)?"   $m;
  default                     $request_uri;
}
Submitted by jpatton@gmail.com