Skip to content

Add UI and logic for displaying redirect suggestion on the BAD_URL error page - #9580

Open
juandiana wants to merge 6 commits into
feature/juan/implement_hostnameresolver_for_suggest_redirect_featurefrom
feature/juan/add_ui_and_logic_for_displaying_redirect_suggestion
Open

Add UI and logic for displaying redirect suggestion on the BAD_URL error page#9580
juandiana wants to merge 6 commits into
feature/juan/implement_hostnameresolver_for_suggest_redirect_featurefrom
feature/juan/add_ui_and_logic_for_displaying_redirect_suggestion

Conversation

@juandiana

@juandiana juandiana commented Aug 21, 2026

Copy link
Copy Markdown

Task/Issue URL: https://app.asana.com/1/137249556945/project/1216807998862658/task/1217666997020568?focus=true
Tech Design URL (if applicable): https://app.asana.com/1/137249556945/project/1216807998862658/task/1217494645371353?focus=true

Description

This PR completes the changes for displaying a redirect suggestion on BAD_URL error page. The feature is behind a feature flag, which is disabled by default at the moment.

Steps to test this PR

  1. Make sure the feature flag suggestRedirct is enabled.
  2. Perform the following steps using both a normal tab and a custom tab:
    1. Navigate to airnow.gov/test
    2. Verify that the redirect suggestion is displayed with only www.airnow.gov underlined
    3. Tap on the underlined link
    4. Verify that the browser navigated to www.airnow.gov/test, loading successfully (minus the expected page not found)
  3. On a normal tab:
    1. Try to navigate to airnow.gov
    2. Verify that the BAD_URL error page together with the redirect suggestion is displayed
    3. Turn on airplane mode
    4. Tap on the redirect link
    5. Verify that the offline error page is displayed and that the redirect suggestion is no longer displayed
    6. Turn off airplane mode
    7. Try to navigate again to the current page, which should be www.airnow.gov
    8. Verify that it loads successfully

UI changes

suggest_redirect_feature_showcase.mp4

Note

Medium Risk
Adds DNS lookups and a navigation path from the error page to a different host (www. prefix). Behavior is feature-flagged and limited to unresolved-host errors, but incorrect suggestions would send users to another origin.

Overview
When a page fails with BAD_URL (unresolved host), the error screen can now offer a tappable “Did you mean www.example.com?” link if the www. variant of a bare eTLD+1 actually resolves. The feature is gated by suggestRedirectOnUnresolvedError (off by default).

SuggestRedirectEvaluator builds the suggestion (scheme/path/query/port preserved) after a DNS check. The ViewModel runs that work asynchronously, stores it on BrowserViewState, and cancels/clears it on navigation, home, refresh, or a new non-omitted error. Tapping the link clears the error and navigates to the suggested URL.

Reviewed by Cursor Bugbot for commit 349de5e. Bugbot is set up for automated code reviews on this repo. Configure here.

@juandiana juandiana changed the title Feature/juan/add UI and logic for displaying redirect suggestion Add UI and logic for displaying redirect suggestion on the BAD_URL error page Aug 21, 2026
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

Successfully merging this pull request may close these issues.

2 participants