Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Little problem with integration of SS in existing dynamic site (Java)

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1747 Views
  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Little problem with integration of SS in existing dynamic site (Java) Link to this post

    Hi all.

    I'm trying to integrate Silverstripe into an already existing website to see whether we can replace the existing front-end with Silverstripe. I'm quite stuck at the moment.

    The situation:
    Existing website is living in the doc-root.
    Silverstripe is living in it's own alias (e.g. /stripe)

    All request to pages (dirs) which are not in the doc-root get rewritten (passthrough) to /stripe. So instead of www.mysite.com/stripe/mypage I can access it through www.mysite.com/mypage.

    I added a rewrite-base to silverstripe's .htaccess :
    RewriteBase /

    also tried
    RewriteBase /stripe

    The Problem:
    All pages and stuff work perfectly ; the problem arises when logging in to the CMS :

    www.mysite.com/admin :
    - Ends up at www.mysite.com/stripe/Security/Login and it displays the login form
    - if I enter incorrect credentials , It displays the correct error-message
    - If I enter correct credentials , it tries to do something but ends up just doing a page refresh. I did not get logged in.

    www.mysite.com/stripe/admin :
    - Also ends up at www.mysite.com/stripe/Security/Login and displays the login form
    - If I enter correct credentials, it logs me in to the silverstripe backend perfectly.

    Problem is ; I loose my session after a couple of clicks in the backend interface (you have been logged out of the CMS bla bla)....

    This problably has something to do with cookies and security , but I cannot for the life of me figure it out...

    I'm hoping someone here has an idea or even tried doing the same thing. Thanks in advance.

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Little problem with integration of SS in existing dynamic site (Java) Link to this post

    When starting a session , Silverstripe tells PHP to send a cookie with the current Base-URL as the cookie path. This is all good , but in my situation I want the cookie to be set at the root (/) so it works for the entire domain.

    I tried setting the baseURL in the config by calling Director::setBaseURL("/") , but doing that gives me a very nasty and weird error ...

    I ended up editing the sapphire/core/session class forcing Silverstripe to create the cookie for the entire domain (/).

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Little problem with integration of SS in existing dynamic site (Java) Link to this post

    Nope.. I thought I fixed it , but I didn't...

    I randomly get logged out of Silverstripe ..... the cookie is set at the top level (/)....

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Little problem with integration of SS in existing dynamic site (Java) Link to this post

    Hmmm..

    I replaced the function protcolAndHost() in sapphire/core/control/Director.php so it returns a fixed value (my domain name and protcol e.g: http:www.blabla.com )...

    At least silverstripe produces the right paths now....

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Little problem with integration of SS in existing dynamic site (Java) Link to this post

    To continue this story...

    The site is up and running (live), but now I have a new problem.

    As long as you do not log in to the CMS , the site runs fine. Once you log-in and start working in the CMS , the system will function properly at first. After a couple of actions (saving pages / deleting pages / clicking around in the site-tree) , the system slows down to a crawl (only for the current user, the rest of the world can still perfectly use the site). It will still continue to function , but excruciatingly slow (I'm talking minutes for all actions : creating pages / moving pages / viewing a draft page).

    My guess is something is going wrong with the load-balancer and sessions , but I can't get my head around it.

    1747 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.