1

Laravel 5.5 will only accept lax, strict or null as sameSite options when setting a cookie and will throw and exception if it is not one of these - before you ask I am stuck with laravel 5.5 for now.

To allow the site to render in an iFrame the cookie needs to be set to SameSite: none

Changing the code in vendor does work, but is not a solution, so I looked at extending the Cookie code and using my own constructor.

I found this ticket:

Laravel 5.5 Override vendor class

but the code I would like to change is in Symfony: vendor/symfony/http-foundation/Cookie.php and there is a CookieServiceProvider in Illuminate with is returning an instance of CookieJar which I can see creates a new instance of the symfony cookie in its make() method

Is there a way to extend the symfony code so that laravel uses my version of the constructor?

2
  • Not sure about the Laravel/Symfony part of the question - but perhaps letting the web server simply manipulate the resulting Set-Cookie header afterwards might be an option? On Apache that should be possible using httpd.apache.org/docs/2.4/mod/mod_headers.html#header Commented Oct 16, 2024 at 11:15
  • An idea: create your own version of the Cookie class, put it somewhere, and include it early enough (so that the standard class is not autoloaded yet). Commented Oct 16, 2024 at 11:43

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.