You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've stumbled upon a possible issue, Currently if the upstream option is set the incoming host header isn't being used. We use a single worker for multiple subdomains, but still need the correct upstream URL. So we need to fetch the subdomain from the incoming request and use it as the subdomain on the upstream URL.
With dollarshaveclub/cloudworker we had to create our own HTTP server so this could be handled easily, But now we are using the server built into MiniFlare which handles things slightly different to our use case.
If we are able to modify the incoming request just before this.dispatchFetch is called it would solve our problem. As long as we had access to the original incoming request and the new request that get's passed to the worker
This will make it much easier to build custom HTTP servers to handle this scenario. I'm planning to release this in the next few weeks... 🤞 (for now, you could probably copy this code into your own application and create your own HTTP server that way, assuming you're not using WebSockets)
Awesome! I've created my own server for now as we don't terminate WS in the worker, We just pass it onto the origin. I look forward to the above update 😁
Hey!
I've stumbled upon a possible issue, Currently if the upstream option is set the incoming host header isn't being used. We use a single worker for multiple subdomains, but still need the correct upstream URL. So we need to fetch the subdomain from the incoming request and use it as the subdomain on the upstream URL.
With dollarshaveclub/cloudworker we had to create our own HTTP server so this could be handled easily, But now we are using the server built into MiniFlare which handles things slightly different to our use case.
If we are able to modify the incoming request just before
this.dispatchFetch
is called it would solve our problem. As long as we had access to the original incoming request and the new request that get's passed to the workerhttps://github.com/mrbbot/miniflare/blob/8010e3321d7913a206839e683ef469c22df5aedb/src/index.ts#L416
The text was updated successfully, but these errors were encountered: