There is an issue with detecting dynamic subdomains when using the Hono client (hc) in Next.js application.
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.
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
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.
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 inhttp://store1.localhost:3000
.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.