Jump to:

21307 Posts in 5737 Topics by 2603 members

General Questions

SilverStripe Forums » General Questions » HTTP Response

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

Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 323 Views
  • Jacob Ingvar Hansen
    Avatar
    Community Member
    1 Post

    HTTP Response Link to this post

    I have 2 questions:

    How can you use your own instance of SS_HTTPResponse as the http response? I tried:

    $a = new SS_HTTPResponse();
    $a->addHeader("Cache-Control", "no-store");
    $a->output();

    I also tried to not use $a->output() and instead pass $a to HTTP::add_cache_headers. No luck.

    The problem is that Chrome do not react on "Cache-Control: no-cache" but needs "Cache-Control: no-store" instead.

    The second question is why "no-store" isn't used in live mode, when it is used in dev mode? no-cache is used in live mode aswell as in dev mode, which signals that the absence of no-store in live mode is a human error?

    Thanks in advance,
    Jacob

  • Willr
    Avatar
    Forum Moderator
    5172 Posts

    Re: HTTP Response Link to this post

    If you're in a controller you should be able to use $this->request->addHeader() to alter the current responses headers.
    http://api.silverstripe.org/2.4/sapphire/control/SS_HTTPResponse.html#methodaddHeader

    If you wish to alter the creation of Request objects see
    http://api.silverstripe.org/2.4/sapphire/control/Controller.html#methodhandleRequest

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