I want to deploy payload under
/fooinstead on the root.
How can I set the baseUrl to
/foo?
Currently payload redirects to
/admininstead of
/foo/adminand also tries to load static files from
/admin/assets/...instead of
/foo/admin/assets/...You can adjust the routes in the config. Here are the defaults
https://github.com/payloadcms/payload/blob/main/packages/payload/src/config/defaults.ts#L48Thank you for your answer.
After adjusting the routes config, the path in the built index.html (I assume thats the admin UI?) is changed to my desired prefix.
But before I reach the admin UI, payload still tries to redirect to
/admininstead of
prefix/admin.
I couldn't find any setting to change this behaviour
This is the call stack in the inspector:
It first redirects to add the missing trailing slash and than it redirects to /admin instead of /cos-cms/admin
(Yes I'm currently hosting payload on our internal gitlab, it's only temporary 😉 But that's why I need to change the base path to
cos-cmsin my case)
Thats my payload.config.ts
I've set the variables to
cos-cmsThink there's a redirect to /admin happening in the server.ts file by default, worth checking out :)
Yes, depending on the template you've used, there may be a redirect to /admin. This was added to assist newcomers in accessing the admin panel. Removing this may resolve your issue.
https://github.com/payloadcms/payload/blob/main/templates/website/src/server.default.ts#L20-L23@967118574445547650
Thank you both!
I removed the redirection in server.default.ts and know it works (aside from the redirection ;))
Star
Discord
online
Get dedicated engineering support directly from the Payload team.