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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Subdomain Not Detected in the Requests #3429

Open
mo-hassann opened this issue Sep 20, 2024 · 1 comment
Open

Dynamic Subdomain Not Detected in the Requests #3429

mo-hassann opened this issue Sep 20, 2024 · 1 comment
Labels
enhancement New feature or request.

Comments

@mo-hassann
Copy link

What is the feature you are proposing?

There is an issue with detecting dynamic subdomains when using the Hono client (hc) in Next.js application.

image
when the user in the subdomain route the Hono API call goes to the main route http://localhost:3000 instead of the route with the subdomain that the user is currently in http://store1.localhost:3000.

image

All the API requests goes to this URL instead of the dynamic URL with the subdomain and that cause an issue because I use the subdomain name to fetch data based on this subdomain name.

When I change the NEXT_PUBLIC_APP_URL manually to be as the URL with the current subdomain every thing works fine.

import { AppType } from "./";
import { hc } from "hono/client";

const client = hc<AppType>(process.env.NEXT_PUBLIC_APP_URL!) // http://localhost:3000 -> http://store1.localhost:3000
@mo-hassann mo-hassann added the enhancement New feature or request. label Sep 20, 2024
@yusukebe
Copy link
Member

Hi @mo-hassann

Basically, the hc is wrapping the fetch, so the behavior is based on the fetch. If you change it to fetch, will the behavior change?

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
None yet
Development

No branches or pull requests

2 participants