Index | Thread | Search

From:
Mischa <openbsd@mlst.nl>
Subject:
Re: httpd unable to match on /?
To:
Tech <tech@openbsd.org>
Date:
Mon, 11 May 2026 20:06:53 +0200

Download raw body.

Thread
On 2026-05-11 18:14, Kirill A. Korinsky wrote:
> 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.

That would be nice! :)

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

Where should they be matched?

Mischa