Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

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

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

Little problem with integration of SS in existing dynamic site (Java)


Reply

5 Posts   1769 Views

Avatar
Fuzz10

27 March 2008 at 2:03am (Last edited: 27 March 2008 2:03am), Community Member, 787 Posts

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.

Avatar
Fuzz10

27 March 2008 at 11:19pm (Last edited: 28 March 2008 10:02am), Community Member, 787 Posts

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 (/).

Avatar
Fuzz10

28 March 2008 at 10:03am Community Member, 787 Posts

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 (/)....

Avatar
Fuzz10

18 April 2008 at 3:24am Community Member, 787 Posts

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....

Avatar
Fuzz10

18 April 2008 at 8:57pm Community Member, 787 Posts

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.