Skip to content

link_to raises "Can't verify CSRF token authenticity" #759

@catmando

Description

@catmando

I have a button_to tag, with data: {turbo_method: :post}

This works.

When I change it to link_to it breaks with Can't verify CSRF token authenticity.

Looking at the post request I cannot see any difference in the headers of the two requests.

BUT the link_to request has zero content length and no payload shown in the chrome debugger.

Is this a bug? It seems that it should work according to the documentation.

In case you are wondering why I care: I am retooling an legacy app to use Turbo Rails / Hotwire, and the style sheets are already set up for this to be an anchor tag. Otherwise it wouldn't be a problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions