I want to deploy payload under
instead on the root.
How can I set the baseUrl to
Currently payload redirects to
and also tries to load static files from
You can adjust the routes in the config. Here are the defaultshttps://github.com/payloadcms/payload/blob/main/packages/payload/src/config/defaults.ts#L48
@denolfe Thank 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
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
in my case)
Thats my payload.config.ts
I've set the variables to
Think 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
@augdust @denolfe Thank you both!
I removed the redirection in server.default.ts and know it works (aside from the redirection ;))