SiteTree::get_by_link() problem

Tags: #<Tag:0x00007f10c7498520>


Silverstripe Version: 3.21


I’m trying to put a Silverstripe website behind a varnish server. I have a controller that given a url path returns its content in json format. I use SiteTree::get_by_link(“page path”) to fetch the page content. For some reason this function returns false when accessed thru the varnish server.

Can someone tell me why this happends?



I think you might need to do a bit of debugging with what’s being passed to that method. If you have a look at the code, silverstripe-cms/SiteTree.php at d33e36c032ba1daafcfeec1d0e7b1b6e352a4e8f · silverstripe/silverstripe-cms · GitHub you can see that it’s just looking in the database for a matching URL segment.
How is the URL segment being passed? Could your Varnish proxy be stripping something out of the request? It might be helpful if you can share some relevant code snippets.


Hi Dorset,

The segment is passed via query string. Here is an example:

Via Varnish:

Via backend (working):

Har File:



I have enabled nested urls.


Line of code I use to get page info.

I hope this help. Thanks for responding!


When I test from here, I get very similar responses to both.

I do notice that your Varnish config is stripping out all the session data, including the locale, etc. but I’m guessing that’s being covered in the URL anyway.