Skip to content

redirectHistory gains /robots.txt and CORS entries after a certificate retry #664

Open

Description

@caugner

What information was incorrect, unhelpful, or incomplete?

When the first request fails certificate verification, Session.init() retries without verification and attaches the redirect-recording interceptor to clientInstance as well (src/retriever/session.js). The later /robots.txt request and the CORS preflight in retrieve() then append their own entries to session.redirectHistory when they return a 2xx status.

For a site with an invalid certificate where https://localhost:58556/ redirects to https://127.0.0.1:58556/:

after page load:    301 https://localhost:58556/, 200 https://127.0.0.1:58556/
after robots.txt:   ..., 200 https://localhost:58556/robots.txt
after CORS OPTIONS: ..., 200 https://localhost:58556/robots.txt, 200 https://localhost:58556/robots.txt

As a result, redirectHistory.at(-1) is no longer the URL the page was served from:

  • The CORS preflight is sent to /robots.txt on the requested host instead of the final page URL.
  • The subresource integrity test derives the page origin from the requested host, so scripts on the final host count as a foreign origin.
  • responses.httpRedirects / responses.httpsRedirects share the same array, so the redirection test sees the extra entries when it uses that session.

What did you expect to see?

redirectHistory only contains the redirect chain of the page request, with or without a certificate retry.

Do you have any supporting links, references, or citations?

Related to #559

Do you have anything more you want to share?

Sites with a valid certificate are not affected, and neither are sites whose /robots.txt returns a non-2xx status (e.g. expired.badssl.com).

Activity

  1. added
    needs triage
    and removed
    needs triage
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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