Skip to content

Allow the XSRF-TOKEN cookie to be renamed #56238

Closed
Closed
@Barbapapazes

Description

@Barbapapazes

Laravel Version

12

PHP Version

8.3

Database Driver & Version

No response

Description

Hello 👋,

I have a static website on soubiran.dev that communicates with an API built with Laravel at api.soubiran.dev. Everything is working fine.

I recently deployed a new website named live.soubiran.dev, and I now have an issue with the XSRF-TOKEN cookie because requests from live.soubiran.dev send both the cookie from api.soubiran.dev and from live.soubiran.dev. Currently, the one from api.soubiran.dev has its domain set to .soubiran.dev to ensure it can be shared with soubiran.dev and the domain for the one on live.soubiran.dev is live.soubiran.dev.

I would love to change the name of this XSRF-TOKEN, but unfortunately, it’s hardcoded and cannot be changed.

Steps To Reproduce

https://github.com/laravel/framework/blob/12.x/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php#L204

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions