Monday, April 05, 2021

Re: relayd to match http request according to path and change headers

* Stephane Guedon <stephane+openbsd@22decembre.eu> le [04-04-2021 23:59:23 +0200]:
> Le dimanche 4 avril 2021 11:31:27 CEST, vous avez écrit :
> > Just a idea, have you tried the keyword request ?
> >
> > Something like
> >
> > match request path "/static/*" forward to <webhosts>
> >
> > Regards,
> >
> > Christoph
> >
>
> Actually, it's not at the forward stage that I have a problem, sorry if
> I explained wrongly.
>
> That part works perfect :
> "match request path "/static/*" forward to <webhosts>"
>
> I am trying to match a request based on the "static" path and set its
> reponse headers.
>
> This is the part where I want to improve things:
>
> match request path "/static/*" response header set "Access-Control-
> Allow-Headers" value "Range"
>
> And those, I always get syntax errors.

I guess that's because you mix "request" and "response".
You can tag the request if you want :

```
match request path "/static/*" tag STATIC
match response tagged "STATIC" header set "Access-Control-Allow-Headers" value "Range"
```

No comments:

Post a Comment