Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: httpd unable to match on /?
To:
Mischa <openbsd@mlst.nl>
Cc:
Tech <tech@openbsd.org>
Date:
Mon, 11 May 2026 18:14:35 +0200

Download raw body.

Thread
On Mon, 11 May 2026 17:44:26 +0200,
Mischa <openbsd@mlst.nl> wrote:
> 
> Hi All,
> 
> I am trying to add a redirect/rewrite matching on something like:
> 
>         location match "^/%?cat=5" {
>                 block return 302 "https://$HTTP_HOST/category/5/"
>         }
> 
> I works with any character which are magic, except ?
> Is this supposed to work?
> 

Yes, everything after `?` is treated as query parameter from current code,
see server_http.c:

   373                          query = strchr(desc->http_path, '?');
   374                          if (query != NULL) {
   375                                  *query++ = '\0';
   376  
   377                                  if ((desc->http_query = strdup(query)) == NULL)
   378                                          goto fail;
   379                          }

But RFC 3986 allows to use ';' as separator as well, probably it need to be
fixed.

Anyway, I not sure that matching by GET parameters in locaiton is good idea.

-- 
wbr, Kirill