23487 Posts in 18996 Topics by 2878 members
|Go to End|
20 August 2011 at 9:10pm Last edited: 20 August 2011 9:16pm
We are running SS2.4.5 and the site is configured to serve up static pages generated by the StaticPublisher.
A full site publish using the StaticPublisher works fine. We are having an issue when a page is edited and republished.
The issue is if an editor updates and republishes (via StaticPublisher::republish()) a page in the CMS, then the republished page gets the same protocol in the url of the <base> tag that the CMS is accessed through. In other words, if the CMS is accessed using the https protocol, then the url of the <base> tag of the republished page also gets the https protocol. Unfortunately, we are using a self-signed certificate so when a site visitor accesses a republished page, s/he is challenged with a certificate warning and if not accepted (understandably), the republished static page does not render properly because the stylesheets, images, etc. cannot be accessed.
To give an example, let's say I generated a static version of a page using the StaticPublisher (via the /dev/buildache?flush=1 task). It's <base> url is initially set to http://my.server.com. If I then go into the CMS (accessed with the https protocol), and edit this page and then save and publish (republish) it, the republished static version of the page then has the <base> url set to https://my.server.com.
Is there a way to detect that if a page is being republished on a site that is configured to served up static pages, then on republish, just use the non-secure http protocol instead of the protocol the CMS is using?
thanks for any input!
21 August 2011 at 11:36am
Thanks to willr on the following solution:
"You can manually set the base url via FilesystemPublisher - http://api.silverstripe.org/2.4/cms/publishers/FilesystemPublisher.html#methodset_static_base_url
This will override Director::baseURL() when publishing."
|Go to Top|