3

I have, on OpenBSD, relayd in front of a website. The thing redirect static requests to httpd and dynamic requests to an app running on localhost port 9000 (I wish to avoid revealing the name so I can write a huge blog article about the solution, sorry). That part works fine.

Now I wish to see if I can optimize the solution by attributing specific headers to specific requests path. Like what I described here (commented because now, does not work).

http protocol https {
    # Various TCP options
    tcp { nodelay, sack, socket buffer 65536, backlog 128 }

    ...

    #match path "/static/*" {
    #response header set "Access-Control-Allow-Methods" value "GET,OPTIONS"
    #response header        set "Access-Control-Allow-Headers" value "Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type"
    #       }

    pass request path "/static/*" forward to <webhosts>

    pass request path "/tracker/socket"     forward to <apihosts>
    pass request path "/socket.io"          forward to <apihosts>
    pass request path "/*"                  forward to <apihosts>
    }

Can I do "match path ..." and set headers ? Until now, all doc I read say you can set headers globally but not on specific paths.

I can set tags, but trying to match on them and set headers after triggers syntax error.

22decembre
  • 131
  • 1
  • I'm not sure it will work as `path` is only for request, if I'm understanding your configuration. What may work is something like `match path tag string` then `match response tagged string...`. – Paul Nov 13 '21 at 22:48

0 Answers0