Replies: 5 comments 1 reply
-
To preface, admin.routes affect both the backend and the frontend. The Frontend (files in src/admin)Changes are pretty simple, you search for function removeTrailingSlash(str) {
return str.endsWith('/') ? str.slice(0, -1) : str;
} In the
The Backend (files in /src/* but not in /src/admin)This side is a bit trickier, in
If we allow We could group them better in this file, and then dynamically attach them in a specific order if either routes.admin or routes.api were set to I am not exactly sure how we want to handle this part. @jmikrut any thoughts here? |
Beta Was this translation helpful? Give feedback.
-
@JarrodMFlesch I think your statements above are accurate. A user would always have to scope one or the other to avoid conflicts, but technically we could determine that in code and mount in the proper order one way or another. This is a feature request rather than a bug though—as we have not intended the Let's make it happen! |
Beta Was this translation helpful? Give feedback.
-
@jmikrut @JarrodMFlesch Before I upvote this, is this the same as asking for |
Beta Was this translation helpful? Give feedback.
-
Hey, Issue summary As explained above, routes in Payload are currently registered in a specific order. At the same time, Payload allows for configuration of internal payload "base routes" as well as registering custom routes and serving of static files. This can lead to conflicts between Payloads internal routes, as well as conflicts between the internal routes and custom routes. Solution & Challenges
After sorting the routes they would need to be registered with the proper method (i.e. This would look something like:
Here is an example I wrote that weights different types of routes according to it's specificity (not a perfect solution, but working I think): Of course, if a decision to move to Next is made, then perhaps this change is no longer relevant. Let me know what you think! |
Beta Was this translation helpful? Give feedback.
-
Why can't we solve this problem? I just want to access Payloadcms at my domain |
Beta Was this translation helpful? Give feedback.
-
Bug Report
In the file
payload.config.ts
changing the propertyroutes.admin
to be the base route of the server/
causes the application to break and only show a blank screen.Steps to Reproduce
After a fresh install of we
npx create-payload-app@latest
-> Fresh Installpayload.config.ts
to includeserver.ts
to not redirect '/' to '/admin'Other Details
The issue was first brought up on discord, at -> https://discord.com/channels/967097582721572934/1047370284975530056/1047525493391507466
With a proposed solution from @JarrodMFlesch
Beta Was this translation helpful? Give feedback.
All reactions