We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15083
    • 697 Posts
    Hi guys,

    This is the current setup:
    mymanager.mysite.com -> Running the MODx manager
    www.mynewsite.com -> Running the MODx frontend.

    Problem:
    When I right click an unpublished resource as an admin, and try to view it, I get a 404.
    I believe the problem is caused by the fact that the front end file that processes the request does not know that the manager is signed in, as he is on a different domain.

    Solution ?? smiley

    Would I be able to write a plugin that checks the refering site, and fools the frontend into thinking there is a valid session etc? Something along the lines of an automatic login.

    Thanks in advance

    J

      • 22303 MODX Staff
      • 10,725 Posts
      You are correct: the sessions cannot be shared across domains. The only way to solve it is to have a Resource on the target domain where manager users can login to that context and get permission to view_unpublished. But the client browser has to get a session cookie set from the target domain.
        • 15083
        • 697 Posts
        Quote from: opengeek at Oct 13, 2011, 11:01 AM
        You are correct: the sessions cannot be shared across domains. The only way to solve it is to have a Resource on the target domain where manager users can login to that context and get permission to view_unpublished. But the client browser has to get a session cookie set from the target domain.

        Have you any idea how I might go about this?
        Can I use the "Login" snippet to create a manager session?
        Would I be able to use curl to do a backround login in a plugin so my manager users dont have to login twice?
          • 15083
          • 697 Posts
          In fact....would this work....

          The manager is isolated on one domain.
          Front end on another.....

          What about if I setup a folder on the managers domain, that has the front end index.php and config.inc.php, and just use that for "view resource" and preview etc. They would not be seeing the preview on the final domain....but I don't think that an issue.

          The user would preview on mymanager.mysite.com/frontend/
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: jusmeig at Oct 14, 2011, 03:02 AM
            Can I use the "Login" snippet to create a manager session?
            You don't want a mgr session, you need to Login to the Context handling the domain you need the session cookie from. And you will need a Policy associated with that User (via User Group membership) that is attached to the Context which includes the view_unpublished permission (I would create a Policy with load, list, view, save, remove, add_children and view_unpublished permissions which you can give to your manager users for this Context. Then you just use Login to login to that Context; once logged in, you can see the unpublished Resources in that browser session.

            Quote from: jusmeig at Oct 14, 2011, 03:02 AM
            Would I be able to use curl to do a backround login in a plugin so my manager users dont have to login twice?
            Not that I know of; the session cookie has to be returned from the target domain directly to the client browser AFAIK.

            There may be a solution to this, but it is not trivial.
              • 22303 MODX Staff
              • 10,725 Posts
              Quote from: jusmeig at Oct 14, 2011, 03:06 AM

              The manager is isolated on one domain.
              Front end on another.....

              What about if I setup a folder on the managers domain, that has the front end index.php and config.inc.php, and just use that for "view resource" and preview etc. They would not be seeing the preview on the final domain....but I don't think that an issue.

              The user would preview on mymanager.mysite.com/frontend/
              Could possibly work if that meets your needs.