Hotwire Discussion

Redirect After PATCH Request

Hi All,

I’m creating following link

link_to 'Action', url, data: { turbo_frame: '_top', turbo_method: :patch }

When user clicks - it correctly sends PATCH request to server where it is handled by controller and controller responds with 302 and new “Location”.

However, browser then sends a request to new “Location” but again with PATCH method.

If I change request to POST - it works correctly and browser follows to new “Location” with GET method.

Have you seen something like this?

Hey Rience,

You need to redirect with a 303 response: Turbo Handbook

Thank you @mrhead - that was it!

I’m still unsure why POST works but PATCH does not. Maybe it could be made clearer in docs?