PHPSESSID: Session Cookie Does Not Contain the “Secure” Attribute

Viewed 533

I'm running https on the frontend and on the backend of my website but how come i'm not getting the secure flag?

I believe the code is here in these two files: magento/framework/Stdlib/Cookie/CookieMetadata.php->getSecure()

    /**
     * Get HTTP Only flag
     *
     * @return bool|null
     */
    public function getHttpOnly()
    {
        return $this->get(self::KEY_HTTP_ONLY);
    }

    /**
     * Get whether the cookie is only available under HTTPS
     *
     * @return bool|null
     */
    public function getSecure()
    {
        return $this->get(self::KEY_SECURE);
    }
}

magento/framework/Stdlib/Cookie/SensitiveCookieMetadata.php->getSecure()

class SensitiveCookieMetadata extends CookieMetadata
{
    /**
     * @var RequestInterface
     */
    protected $request;

    /**
     * @param RequestInterface $request
     * @param array $metadata
     */
    public function __construct(RequestInterface $request, $metadata = [])
    {
        if (!isset($metadata[self::KEY_HTTP_ONLY])) {
            $metadata[self::KEY_HTTP_ONLY] = true;
        }
        $this->request = $request;
        parent::__construct($metadata);
    }

    /**
     * {@inheritdoc}
     */
    public function getSecure()
    {
        $this->updateSecureValue();
        return $this->get(self::KEY_SECURE);
    }

    /**
     * {@inheritdoc}
     */
    public function __toArray()
    {
        $this->updateSecureValue();
        return parent::__toArray();
    }

    /**
     * Update secure value, set it to request setting if it has no explicit value assigned.
     *
     * @return void
     */
    private function updateSecureValue()
    {
        if (null === $this->get(self::KEY_SECURE)) {
            $this->set(self::KEY_SECURE, $this->request->isSecure());
        }
    }
}

enter image description here

I've tried a few different things but haven't been able to get it to secure. Help please.

0 Answers
Related