Hello! So I am trying to move the multi-tenant example over to 3.0 and ive faced some issues regarding "host". in the multi tenant example they use req.headers.host which gives you the domain your accessing the website by.
if you added
abc.localhost.comand
bbc.localhost.comto your hosts file, the multi-tenant example will properly show the domain in the
req.headers.hostproperty.
However, in 3.0 req.headers does not exists (supposedly) and
hostis now on the top-level of req. (
req.host)
my issue is, is that
req.hostwill
ALWAYSreturn
localhostin development unless you manually set
-Hwith nextjs, but this ends up not creating the system you want to test multiple subdomains locally.
I understand this issue probaly comes from nextjs itself and hoping a patch can be added to bring back the functionality in local development of
req.hostor if you add back
req.headers.hostthat the value will be the actual value that represents how your accessing it, regardless if they all point to localhost or not.
😢
Not moved it yet but I'm working out of the multitenant example too, working locally with hosts as well.
This may be slightly of topic, but today I found Vercel doesn't seem to add headers.host (and headers.origin) to requests at all(?), except on rewrites, where it sets headers.host to recipient host. Which is a wrench in the Payload multi-tenant example access control setup.
Hi, have you managed to figure out a solution to the req.headers.host being redirected to localhost? My multi-tenant payload system pretty much has come to a stop now that every thing is getting redirected to localhost.
I would apprecaite if you have any ideas or workarounds on this.
Personally no, I believe this just has to do with nextjs. It works in production on vercel just not in a local environment. So I basically have faith that subdomains work properly and just access everything from the localhost in dev
@1074867232632488038Thanks
@131645553070178305!
This seems to be broken again
in the latest version
req.host now is localhost EVEN on vercel
yep same issue here also being spammed with apiKey not found
This as well!
would you know?
Have you submitted an issue? Can you do so or link to existing? (I'm not able to find one)
https://github.com/payloadcms/payload/issues/6392
just created one
Host/Headers in 3.0.beta.32
is there any updates on this?
sorry for the ping, i know the issue has not been updated or spoken on but i was curious if you had any insight into it?
😭
friday im suppose to show the client how to use it and i wont be able to let him use his admin account for the tenant since req.host just doesnt work
Pretty sure
@281120856527077378starting looking into this one again today
Okay great thanks
I just checked the issue and saw he was added
can you give this a shot on the latest beta?
should be fixed
I’ll do it right now!
you fixed it! Thank you haha, right in the nick of time too
haha I know right 😆
Star
Discord
online
Get dedicated engineering support directly from the Payload team.