fresh
fresh copied to clipboard
feat(server): automatically extract forwarded-for header
closes https://github.com/denoland/fresh/issues/1827 Or rather, the discussion that happens later in the issue.
This change modifies the call to Deno.serve
to automatically extract the X-Forwarded-For
header, if it exists. This is then available in HandlerContext
, MiddlewareHandlerContext
, and RouteContext
.
@marvinhagemeister, based on https://github.com/denoland/fresh/issues/1827#issuecomment-1794435015 I guess I should close this. Before I do though: do you see any value in having the handler
passed to Deno.serve
configurable/overridable? If not, I'll close it. If yes, I can rework this.
Right now I don't see any way of controlling middleware execution order, so if someone absolutely needs something to run first, they're out of luck. Being able to override the Deno.serve
handler and having the ability to order middleware (especially from plugins) seems like it would increase flexibility. I can open a separate issue for middleware ordering if desired.