Jump to:

23581 Posts in 19403 Topics by 2893 members

General Questions

SilverStripe Forums » General Questions » StaticPublisher: republishing issue

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 814 Views
  • aragonne
    Community Member
    26 Posts

    StaticPublisher: republishing issue Link to this post


    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!

  • aragonne
    Community Member
    26 Posts

    Re: StaticPublisher: republishing issue Link to this post

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

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.