Comments (3)
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: '/',
},
]
},
}),
)
from payload.
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.
What i do is i'm using NextResponse.rewrite
in the middleware.ts
if req.host
is for the admin. So my "real" route is still "/admin" and i didn't change any folder structure.
I sucessfully achieved this working with providing routes.admin: ""
without any broken links.
I'm not sure if it sounds good but if we just map the "/"
value to ""
in our sanitize function or joi schema then it should be fine, no need to change something else!
from payload.
@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 🤔
from payload.
Related Issues (20)
- List view > Filters > "is in" operator > operand value doesn't support multiple selections in Relationship fields
- HMR looping if importing from generated types HOT 1
- Multiple Local API queries in hooks will never resolve (Postgres) HOT 5
- Reset Password link redirects to sign-in page HOT 1
- Toast stuck on submitting when resetting password
- Npm projects receiving `Cannot find module 'drizzle-orm/pg-core'`
- type SelectFieldProps onChange props is typed incorrectly HOT 1
- Resizing silently fails if `sharp` is not defined in config HOT 1
- Doesn't change time from 12-hour format to 24-hour based on locale. HOT 1
- CollapsibleProvider's withinCollapsible is never true. Missing withinCollapsible related CSS classes. HOT 1
- app not response when use payload local api in hook like afterRead HOT 1
- Nodemailer Email Adapter: skipVerify=true does not skip verification
- #6718 generate:types Fails with Endpoint in Collection Configuration reproduction HOT 1
- UseField() with custom select field not functioning inside of an array field HOT 1
- Payload Settings Language No other language found HOT 1
- Hydration error on dates HOT 4
- Errors when build and deploy HOT 1
- PaginatedDocs<TypeWithID & Record<string, unknown>> HOT 7
- GraphQL returns inconsistent results for relationships HOT 3
- Custom textarea field components can't be saved within a block HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from payload.