Turbo doesn't work with Cloudflare Challenge

It seems that in Rails apps that use Turbo the Cloudflare challenge, when triggered, is not displayed to the user… Basically the user cannot load the challenge and simply the new navigation event (e.g. click on a link, form submission, etc.) doesn’t work.

Anyone managed to use the Cloudflare challenges with Rails Turbo?

I’m not using it, but I’ve had similar problems. Turbo has life cycle callbacks that you can add listeners to. In theory you should be able do listen to them, get the HTML of the response, check for a Cloudflare challenge, and then force a normal navigation, or to something with the HTML

addEventListener("turbo:submit-end", (event) => {
  // Code goes here
})
2 Likes