-
On a backend data server in development mode I'm serving some static html assets from a production site, let redirectHandler targetHost permanent _url : EndpointHandler =
fun ctx -> redirectTo $"%s{targetHost}{ctx.Request.Path}" permanent ctx
let endpoints = [
subRoute "/api" [ apiEndpoints ]
routef "/static/{%s}" (redirectHandler "http://frontend.server" true)
] Problem is that this is redirecting just the files in the root directory but not in subdirectories. Is there a way to instruct Oxpecker to match everything after the prefix? I think I could write a custom |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@pkese You should be able to use * or ** like that |
Beta Was this translation helpful? Give feedback.
-
This works perfectly. Amazing. Thanks. All it needs is a line or two of documentation. let redirectHandler targetHost permanent : EndpointHandler =
fun ctx -> redirectTo $"%s{targetHost}{ctx.Request.Path}" permanent ctx
let endpoints = [
subRoute "/api" [ apiEndpoints ]
route "/static/{**path}" (redirectHandler "http://frontend.server" true)
] |
Beta Was this translation helpful? Give feedback.
I've just published a new version with catch-all routes support for
routef
and also updated documentation