janum's avatar

janum started a new conversation+100 XP

4mos ago

hi i am looking for vps server located in usa to host data of my website which is on heavy cms such as ghost . i asked from chatgpt and it says that ghost and other cms can only install on vps so i need to buy this. for this i browse for this and found that hostinger provides best vps plan wiht mulltiple ram version. with 2 gb to 16 gb with good price. now i want to confirm is it ok or is ther any other hosting provider https://shorturl.at/r0AlY whcih will be good. tell me your real feedback so i can decide before i buy one.

janum's avatar

janum wrote a reply+100 XP

5mos ago

I have been through this exact pain with Laravel, Inertia and React, and most of the old advice online does not fully apply to Laravel 12 anymore. The main issue I learned is that CSRF failures rarely come from Laravel itself. They almost always come from token desync, caching, or a missing handshake somewhere between the first page load and the actual request.

Here are the things that finally gave me a completely stable setup with zero 419 errors:

1. Never rely on a manually refreshed CSRF token in React The React util works, but it is only a band-aid. The correct flow is to let Laravel handle token rotation and just call: GET /sanctum/csrf-cookie before any authenticated request. Inertia automatically sends the XSRF-TOKEN cookie as long as it exists.

2. Make sure nothing is caching the HTML that contains the CSRF token I had random failures only in production due to Cloudflare caching the initial Inertia response for a few minutes. The CSRF cookie was fresh, but the client was rendering an old Inertia page that referenced an expired token. That caused the “occasional 419” effect. Solution: Disable page caching for all Inertia routes or at least bypass CSRF cookies.

3. Confirm that your Stripe redirect is excluded correctly Redirects from external domains will always break the CSRF cookie unless you exclude the callback route. Laravel 12 uses the VerifyCsrfToken middleware the same way as older versions. Make sure the Stripe return callback and any interim webhooks are in that $except array.

4. Check for SameSite issues on Chrome One of my weirdest 419 cases was caused by Chrome treating the XSRF-TOKEN cookie as SameSite=Lax during a redirect. Setting it explicitly to SameSite=None; Secure stabilised everything:

Session::setCookieParameters([
    'same_site' => 'none',
    'secure' => true
]);

5. For Inertia, always make the first request visit /sanctum/csrf-cookie A lot of devs forget this step. Once the cookie is set, the CSRF header is handled automatically. No need to manually fetch the token at all.

6. Nightwatch failures usually mean “token rotated between steps” If the only failures now appear in Nightwatch, not in real users, then the test runner is hitting the app too quickly and invalidating its own token sequence. I had this happen as well. Adding a short wait before form submission fixed my false positives.

After fixing these pieces, my app stopped producing 419 errors completely, even under load.

CSRF in Laravel 12 is actually very stable; the tricky part is understanding how React, Inertia and external redirects interact with the cookie. Once you lock those flows down, it becomes predictable.

Hopefully some of this helps, because I know exactly how frustrating the random failures can be.

janum's avatar

janum wrote a reply+100 XP

5mos ago

i think what you are doing actually makes sense and you are moving in the right direction. Using the service container tag approach is cleaner than calling app() inside your method for each validator. It makes your AttachMembersToRoom class more testable and decoupled because the validators are injected rather than resolved manually.

A few points to consider:

Memory / Performance: Tagging validators in the container doe not instantiate them all upfront unless you explicitly resolve them. PHP will lazy-load them when iterating over $memberValidators, so memory usage is usually fine.

Testability: Since you inject an iterable of validators, you can now mock or bypass individual validators in tests easily by passing a custom iterable to the constructor. That is much cleaner than using app() directly.

Simplicity vs Overcomplication: If you only have a few validators, this might feel like overengineering, but if your validation rules grow, this approach scales well. You could even add an interface like MemberValidatorInterface to make it explicit what each validator does.