Nov 8, 2025

2 min read

Solving the Hotwire Native 406 Unsupported Browser Error

Learn how to fix the Rails 8.0 allow_browser feature blocking Hotwire Native WebViews and resolve the 406 unsupported browser error in your iOS app.

By JTPCK Team

Solving the Hotwire Native 406 Unsupported Browser Error

In a recent update to a Ruby on Rails 8.0 application, I encountered an issue triggered by the new allow_browser feature in Rails. This feature is designed to block unsupported or outdated browsers from accessing the app by checking their user agent. However, this became problematic in a Hotwire Native setup where the app’s iOS WebKit view was mistakenly flagged as unsupported.

The issue first surfaced through a Sentry monitoring alert showing an ArgumentError:

ArgumentError: File /app/public/406-unsupported-browser.html does not exist



The stack trace pointed to Rails attempting to render a static error page that wasn’t present in the /public directory. This happens when allow_browser determines that the client’s browser doesn’t meet the version criteria. By default, the method tries to serve a 406-unsupported-browser.html file, which is not created automatically.


After tracing the error, I found the culprit inside rails/app/controllers/application_controller.rb.

The controller included the following line:

```ruby class ApplicationController < ActionController::Base include Pundit::Authorization

allow_browser versions: :modern

end

```



The allow_browser method was apparently rejecting my iOS Hotwire Native WebView as an outdated browser. Since this WebView runs inside a controlled environment using modern WebKit, the restriction wasn’t necessary.

Removing this configuration resolved the problem immediately. The updated file now looks like this:

With the allow_browser versions: :modern line removed, the application no longer checks browser compatibility at the framework level. This means all browsers, including embedded WebViews, can access the app without triggering a 406 error. In a Hotwire Native environment, this is the correct behavior because the WebView environment is already known, consistent, and secure.

If in the future you want to enforce browser restrictions, you could either create a custom 406-unsupported-browser.html file under /public or configure allow_browser with a custom block that excludes specific user agents. For example:

ruby allow_browser do |browser| browser.modern? || browser.user_agent.include?("MyHotwireApp") end



This approach allows you to maintain browser filtering while explicitly allowing your Hotwire Native app to bypass the check.

rails hotwire hotwire-native ios webview troubleshooting

Keep Reading

More from the studio.

All Posts