Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All responses are 409 #76

Closed
grantholle opened this issue Oct 5, 2019 · 11 comments
Closed

All responses are 409 #76

grantholle opened this issue Oct 5, 2019 · 11 comments

Comments

@grantholle
Copy link

Not an issue, more of a question.

I am getting 409 responses when using <inertia-link>. The page then reloads the intended url and is working fine, due to this behavior.

Any idea what could be causing this? When visiting directly/testing everything is 200. I feel like there's a conflicting header?

Here are the headers according to Telescope:

{
cookie: "remember_web:applicants_59ba36addc2b2f9401580f014c7f58ea4e30989d=eyJpdiI6IlRja01BVGdhNERGMDVsYzNPaXVVUXc9PSIsInZhbHVlIjoidGRiN2tJRUJldWhcLzJTWE1QanpZQlpzd0dYV3V1em4xWEl6WnJuXC9yVUhPV0FtZDhrVFc0MmMxTkJcL1MyYmlMZFhuZStHZE5uR0s0NjFCM2pJV25ZNGxBUXU1NjVhTGJwVE5SV2RNNWpHNmpSeDFuN1Bmam5nMzBId3BGK2wwYkdzZHRuVHVWVW82a3JMYjlmeG9hdXcxXC9XS3BpdHJPZFZ0YWIrbHZkTkxuOD0iLCJtYWMiOiIxM2JmYWJkYjJlNGM2OTM0YmNiNWZlODFlNTI3MmQ0Yjg5MDEzMTljZmNlMDdlZmE4MmMwMDI2MzQ1NTc3MzMzIn0%3D; XSRF-TOKEN=eyJpdiI6InRUYzMyZjFWeFJtUmFpVTZqdHR1emc9PSIsInZhbHVlIjoickN2a0Jyem5uQ242VW1MWjA4SnFLTFlnSFJSOXF4UWFlXC85eEo4WTB3aGQwNUpSbytoRkl1eVFrOTRPWXZ0dTciLCJtYWMiOiI1ODQ3MzM4ZjZlNDU1NjUxYzY5NWQ3YTkzNjRiMTYyZDZjYTQzMzM4NWU0ZDM0N2JhNmRlYjRmYWUwMWFlY2E5In0%3D; ldi_apply_session=eyJpdiI6Ims3WG5GR2dvOUdiMWlyRGhPZ2h5M0E9PSIsInZhbHVlIjoiejJkd0tOSHFWRFwvUFVqcEpyV2syaVwvSlpYMndrRitQaHJGdWRGTnphOFwvY3BVZjQ3dmlYXC9XZjdXclRtaEhZNjciLCJtYWMiOiIwNzAwNDE5YzhlMmIzOTIyNGYxYWE1MTAyZDVmOWFjZTNlOGZkOTUyNzAwZTM3MjdhNDJjMjlkNjMxMWUyNTExIn0%3D",
accept-language: "en-US,en;q=0.9,ar;q=0.8,fr;q=0.7",
accept-encoding: "gzip, deflate",
referer: "http://ldi-apply.test/steps/1/forms/3/edit",
x-requested-with: "XMLHttpRequest",
x-inertia-version: "a86ad0584af7daf29b57549e69872177",
accept: "text/html, application/xhtml+xml",
content-type: "application/json;charset=utf-8",
user-agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36",
x-inertia: "true",
x-xsrf-token: "eyJpdiI6InRUYzMyZjFWeFJtUmFpVTZqdHR1emc9PSIsInZhbHVlIjoickN2a0Jyem5uQ242VW1MWjA4SnFLTFlnSFJSOXF4UWFlXC85eEo4WTB3aGQwNUpSbytoRkl1eVFrOTRPWXZ0dTciLCJtYWMiOiI1ODQ3MzM4ZjZlNDU1NjUxYzY5NWQ3YTkzNjRiMTYyZDZjYTQzMzM4NWU0ZDM0N2JhNmRlYjRmYWUwMWFlY2E5In0=",
cache-control: "no-cache",
pragma: "no-cache",
connection: "keep-alive",
host: "ldi-apply.test",
content-length: ""
}

The response in Telescope just says "HTML Response".

@reinink
Copy link
Member

reinink commented Oct 5, 2019

Yes, this is caused by asset versioning. A 409 response is sent when your assets are out of date. You can use this to force an asset update, which is really helpful!

@reinink reinink closed this as completed Oct 5, 2019
@grantholle
Copy link
Author

Does this happen automatically or will I need to include

Inertia::version(function () {
    return md5_file(public_path('mix-manifest.json'));
});

in my AppServiceProvider? This behavior has started relatively recently when it had been working fine. This behavior is good when it's needed, I just don't know why it has started suddenly.

@reinink
Copy link
Member

reinink commented Oct 5, 2019

No, it doesn't happen automatically. It should only happen if you're using Inertia::version(). Are you not using this?

@grantholle
Copy link
Author

Actually I just realized I had it already. Removing it solves my issue 🤷‍♂️

@reinink
Copy link
Member

reinink commented Oct 5, 2019

Okay cool. I would recommend not removing it, as this is very helpful behaviour if you're using code splitting.

@grantholle
Copy link
Author

Yes absolutely. I just figured out what is happening.

I've extended Inertia to support API resources (#70), and the middleware isn't using my class, therefore not my version! Adding in the additional version() call resolves everything...

Thanks so much Jonathan!

@marcuschristiansen
Copy link

@reinink I have a similar issue but it keeps refreshing every time. What do I do to bring these assets up-to-date?

@yamchinghann
Copy link

yamchinghann commented Jul 18, 2023

@reinink I have a similar issue but it keeps refreshing every time. What do I do to bring these assets up-to-date?

i have similar your issue as well but i have solved it by modifying this code line at HandleInertiaRequests.php file
public function version(Request $request): ?string { //return parent::version($request); return ''; }

@marcuschristiansen
Copy link

@reinink I have a similar issue but it keeps refreshing every time. What do I do to bring these assets up-to-date?

For me this was an issue with the fact that we have a load balancer in place. Using sticky sessions resolved it for us.

@JIscariot
Copy link

Use @inertiajs/inertia-vue3 instead of @inertiajs/vue3

@jjdreba
Copy link

jjdreba commented Jun 5, 2024

I had the same issue for a while, so I wanted to share my approach for any future readers:

if you use any Vue specific handlers such as @click="selectSortOption(option)", this will cause a full page refresh as it is not in line with inertias asset versioning. Save yourself some troubles and read the Inertia docs, use < Link > and Inertia native navigation if you want to avoid frequent issues with 409s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants