-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Navigation in the admin panel is broken if routes.admin is set to "/" #6482
Comments
Hey @r1tsuu I think we should discuss what we want to do here. We would likely need to touch every file that uses adminRoute or routes.admin, and then adjust them accordingly. There are some places that will break if the admin route is "/" or "", bc the links or routes generated using it will be incorrect, i.e. "/admin/[route]" will become "//[route]". You could in the meantime, add a redirect in your next config like so: export default withBundleAnalyzer(
withPayload({
async redirects() {
return [
{
destination: '/admin',
permanent: true,
source: '/',
},
]
},
}),
) |
The problem is that i don't want to do a redirect here, because what i want is to host the admin panel on a different domain from frontend which is on the same server too. |
@r1tsuu I tried that earlier, remapping inside the sanitize function. But after logging into the admin panel I was facing an issue with a Link component somewhere, saying the href was undefined 🤔 |
I've got a feature started for this on the feat/root-admin branch. I will pick back up on this work shortly. |
@r1tsuu this should go out in the next release |
Cool, thank you |
This issue has been automatically locked. |
Link to reproduction
No response
Payload Version
3.0.0-beta.35
Node Version
20
Next.js Version
15rc
Describe the Bug
When setting
routes.admin: "/"
links in the admin panel don't have slash at the start, resolving into a string like "collections/admins" which is invalid and doesn't work, instead we need to apply slash like we expect "/collections/admins"Also i would mention that if i change Payload joi Validation to accept
admin.routes
empty string value""
then it works like i expect with"/"
.Reproduction Steps
routes.admin
to "/".Adapters and Plugins
No response
The text was updated successfully, but these errors were encountered: