Giter Club home page Giter Club logo

Comments (3)

JarrodMFlesch avatar JarrodMFlesch commented on June 17, 2024

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.

r1tsuu avatar r1tsuu commented on June 17, 2024

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.

JarrodMFlesch avatar JarrodMFlesch commented on June 17, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.