Skip to content

Conversation

@wpeterson
Copy link

@wpeterson wpeterson commented Nov 7, 2025

This PR adds the ability to customize the HTTP timeouts used when fetching content for prerendering via Net::HTTP:

  • timeout for both read_timeout and open_timeout
  • read_timeout
  • open_timeout

Note

Adds configurable Net::HTTP timeouts and refactors HTTP request/client creation with accompanying tests.

  • Prerender middleware (lib/prerender_rails.rb):
    • Add configurable timeouts: supports global timeout, and per-option open_timeout and read_timeout (applied to Net::HTTP).
    • Refactor HTTP calls:
      • New build_http_client(uri) sets use_ssl, open_timeout, and read_timeout.
      • New build_http_request(uri, headers) builds Net::HTTP::Get and applies basic auth when enabled.
      • get_prerendered_page_response now uses these helpers.
  • Tests (test/lib/prerender_rails.rb):
    • Add specs for build_http_client covering SSL selection and timeout configuration.
    • Keep existing URL-building tests intact.

Written by Cursor Bugbot for commit fb3ede2. This will update automatically on new commits. Configure here.

@wpeterson
Copy link
Author

@thoop Would love if you had time to take a look at this PR. Being able to customize timeouts seem like a key safety mechanism.

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.

1 participant