my application has a somewhat unique configuration that isn't playng nice with the default behavior of appendNext in this plugin.
in order to direct all requests for text/html to a single route so that they can be routed by react-router, i have created a plugin that adds an onRequest handler to re-route all of these requests to a /html route.
then, in the /html route, i access request.raw.req.url to pass the original route to react-router.
the problem arrises when a redirect happens due to the lack of a session cookie. appendNext looks directly at request.url.path, so it is always /html in my case.
would it make sense to reference request.raw.req.url instead of request.url.path? the same value should be available from the raw request (in some variation, maybe not raw.req.url) to cover the common case, but would then also cover the .setUrl() case like mine as well.
if this isn't desirable, could an option be added to get the value in another way? maybe provide a callback that received the request object and expected the desired value to be returned?
for a little more context, i would have preferred to solve my original routing problem through content-negotiating config on my hapi routes, but since hapi does not support that, my current solution was a recommendation from the hapi team and seems like the next best option.
my application has a somewhat unique configuration that isn't playng nice with the default behavior of
appendNextin this plugin.in order to direct all requests for
text/htmlto a single route so that they can be routed by react-router, i have created a plugin that adds anonRequesthandler to re-route all of these requests to a/htmlroute.then, in the
/htmlroute, i accessrequest.raw.req.urlto pass the original route to react-router.the problem arrises when a redirect happens due to the lack of a session cookie.
appendNextlooks directly atrequest.url.path, so it is always/htmlin my case.would it make sense to reference
request.raw.req.urlinstead ofrequest.url.path? the same value should be available from the raw request (in some variation, maybe not raw.req.url) to cover the common case, but would then also cover the.setUrl()case like mine as well.if this isn't desirable, could an option be added to get the value in another way? maybe provide a callback that received the
requestobject and expected the desired value to be returned?for a little more context, i would have preferred to solve my original routing problem through content-negotiating config on my hapi routes, but since hapi does not support that, my current solution was a recommendation from the hapi team and seems like the next best option.