Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃殌 Feature Request: Override http://placeholder url in miniflare fetch proxy #5772

Open
bruceharrison1984 opened this issue May 7, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@bruceharrison1984
Copy link

bruceharrison1984 commented May 7, 2024

Describe the solution

I'm not exactly sure how this could be done, but when trying to utilize something like Hono OpenAPI from Miniflare, the context object results in a host-relative incorrect URL:

apiV1.doc('/doc', (ctx) => ({
  openapi: '3.1.0',
  info: {
    version: '1.0.0',
    title: 'Torch',
  },
  servers: [{ url: `${new URL(ctx.req.url).origin}/api/v1` }],
}));

image

This isn't an issue in Production because the correct URL is present in the request. In the case of local development, we don't have access to the true hostname from the context, so there isn't any way to fixup this URL because we don't know what the original hostname was supposed to be.

@bruceharrison1984 bruceharrison1984 added the enhancement New feature or request label May 7, 2024
@penalosa
Copy link
Contributor

Does this happen with Wrangler, or when running Miniflare directly?

@bruceharrison1984
Copy link
Author

bruceharrison1984 commented May 10, 2024

This is when running Miniflare directly via unstable_dev for use in a Vite plugin.

https://github.com/TorchAuth/vite-plugin-wrangler-spa/blob/main/src%2FminiflarePlugin.ts#L21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Untriaged
Development

No branches or pull requests

2 participants