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, Ed, biapar, Willr, Ingo

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

Go to End

5 Posts   2026 Views


Community Member, 791 Posts

27 March 2008 at 2:03am

Edited: 27/03/2008 2:03am

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 I can access it through

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 : :
- Ends up at 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. :
- Also ends up at 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.


Community Member, 791 Posts

27 March 2008 at 11:19pm

Edited: 28/03/2008 10:02am

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


Community Member, 791 Posts

28 March 2008 at 10:03am

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


Community Member, 791 Posts

18 April 2008 at 3:24am


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

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


Community Member, 791 Posts

18 April 2008 at 8:57pm

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.