1

Hi guys as may already know salesforce changed Debug logs for Site Guest User in winter 17. And I ran into a problem, I can't set the cookies from current page controller (Apex Controller), I get the cookies but with a prefix, in this case "apex_".

So my question, is there anyway to prevent Apex code prepend that prefix on my cookie name?

Here is the code I'm using. (I can't set document.cookie from JS, since current apex page content type is text/xml)

Apexpages.currentPage().setCookies(new Cookie[]{
    new Cookie('debug_logs', 'debug_logs', null, -1, false),
    new Cookie('domain', '.force.com', null, -1, false)
});
4
  • Why not set it from the client side instead? Just use Javascript.
    – Adrian Larson
    Oct 21, 2016 at 14:20
  • I can't set document.cookie from JS, since current apex page content type is text/xml. And I'm using the force.com site as an endpoint... I forgot add that. Oct 21, 2016 at 14:48
  • Are you able to set a cookie using html?
    – Adrian Larson
    Oct 21, 2016 at 16:23
  • The Cookie class always uses apex__ as a prefix. This applies to reading and writing cookies. It's a security feature. You'll need to find anther way to work around the problem. Speaking of which, why is this a problem?
    – sfdcfox
    Oct 21, 2016 at 16:28

0

You must log in to answer this question.

Browse other questions tagged .