Skip to content

Commit 30562ea

Browse files
gildesmaraisclaude
andcommitted
docs: botasaurus timezone, egress policy and scraper log events
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 47e227a commit 30562ea

3 files changed

Lines changed: 53 additions & 32 deletions

File tree

‎src/content/docs/ruby-gem/reference/strategy.mdx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The client speaks OpenAPI 2.0 `ScrapeSuccess` / `ScrapeError` envelopes. Success
7474
Supported `request.botasaurus` options (unknown keys are rejected):
7575

7676
- `execution_mode` (`auto`, `request`, `browser`; scrape-API default `auto` when omitted)
77-
- `navigation_mode` (`auto`, `get`, `google_get`, `google_get_bypass`, `organic_get`; default `auto`)
77+
- `navigation_mode` (`auto`, `get`, `google_get`, `google_get_bypass`; default `auto`)
7878
- `max_retries` (`0..3`; omit to use the scrape-API default of `2`)
7979
- `wait_for_selector` (string)
8080
- `wait_timeout_seconds` (integer `1..30`; omit to use the scrape-API default of `15`; counts against post-boot **work** budget on the scraper, not browser boot)
@@ -84,10 +84,11 @@ Supported `request.botasaurus` options (unknown keys are rejected):
8484
- `block_trackers` (boolean)
8585
- `wait_for_complete_page_load` (boolean)
8686
- `headless` (boolean, default `false`)
87-
- `proxy` (string, `http://` only, credentials allowed; `https://` and `socks` proxies are rejected)
87+
- `proxy` (string, `http://` only, credentials allowed; `https://` and `socks` proxies are rejected). The scrape API checks every destination against its network policy first, then hands the hostname to the proxy. A rotating residential gateway works; a proxy that intercepts TLS with its own certificate does not.
8888
- `user_agent` (string)
8989
- `window_size` (`{ width: 1920, height: 1080 }` — both positive integers, required together)
9090
- `lang` (string, for example `en-US`)
91+
- `timezone` (string, IANA id such as `Europe/Berlin`; browser tier only). The browser reports it to pages through `Intl`, `Date` and workers. With a proxy, set it to the exit country's zone. When omitted, the scrape API uses `SCRAPE_DEFAULT_TIMEZONE`, else UTC. Unknown ids fail with `422`.
9192
- `headers` (hash, forwarded to the Botasaurus scrape API alongside config-level `headers`)
9293
- `cookies` (hash)
9394

@@ -148,7 +149,7 @@ Because no remote network connection is established, `local_file` skips remote n
148149

149150
## Network safeguards
150151

151-
Every strategy that makes network requests checks the requested URL against the guard before fetching. The default HTTPX transport also checks every redirect hop and filters the addresses a hostname resolves to. With `botasaurus`, redirects happen inside the Botasaurus service, so its own network policy applies to them. `local_file` makes no network requests.
152+
Every strategy that makes network requests checks the requested URL against the guard before fetching. The default HTTPX transport also checks every redirect hop and filters the addresses a hostname resolves to. With `botasaurus`, the fetch happens inside the scrape API, which applies the same policy to every connection the browser or its HTTP client makes. That covers redirects, sub-resources, iframes, XHR/fetch and websockets. WebRTC is limited to proxied traffic, so a page cannot send UDP around the policy. A refused navigation or redirect fails the scrape with `403`. A refused sub-request is dropped, and the page still renders. `local_file` makes no network requests.
152153

153154
- **Private networks are denied.** Local hostnames, loopback, link-local, private (RFC 1918), unique-local and multicast addresses fail with `RequestService::PrivateNetworkDenied`.
154155
- **Embedded IPv4 addresses are checked.** An IPv4-mapped IPv6 address (`::ffff:a.b.c.d`) is judged by the IPv4 address inside it. So are NAT64 (`64:ff9b::/96`) and 6to4 (`2002::/16`) addresses.

‎src/content/docs/web-application/reference/env-variables.mdx‎

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,35 @@ description: "Configuration reference for html2rss-web environment variables."
55

66
## Supported ENV variables
77

8-
| Name | Description |
9-
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10-
| `HTML2RSS_SECRET_KEY` | required in production; development/test gets a temporary default |
11-
| `HTML2RSS_ACCESS_TOKEN` | token for the main feed-creation flow; paste the same value into the web UI when prompted |
12-
| `HEALTH_CHECK_TOKEN` | optional bearer token for authenticated `GET /api/v1/health`; not part of the first-run quickstart; use `/api/v1/health/ready` for standard readiness checks |
13-
| `BUILD_TAG` | release metadata used in logs; published Docker images set this to the release version |
14-
| `GIT_SHA` | deployed commit metadata used in logs; published Docker images set this to the released commit |
15-
| `SENTRY_DSN` | optional; enables Sentry errors/logs when set |
16-
| `BOTASAURUS_SCRAPER_URL` | optional; Botasaurus scrape API base URL (e.g. `http://botasaurus:4010`) for browser rendering and anti-bot bypass |
17-
| `AUTO_SOURCE_ENABLED` | boolean. The app default is `true` in development/test and `false` otherwise. The shipped `docker-compose.yml` (default `true`) and `docker-compose.quickstart.yml` (`true`) both enable it. |
18-
| `CONFIG_CATALOG_ENABLED` | optional boolean; default `true`. When `false`, `GET /api/v1/configs` returns `404` with `catalog_disabled`. |
19-
| `BOTASAURUS_SENTRY_DSN` | optional; read by the production compose file and passed to the botasaurus service as its own `SENTRY_DSN`. Use a separate project from `SENTRY_DSN`. |
20-
| `TLS_CERTIFICATE_PATH` / `TLS_KEY_PATH` | optional; certificate and private key paths for TLS termination inside the app. Without them, terminate TLS in a reverse proxy. |
21-
| `ASYNC_FEED_REFRESH_ENABLED` | optional boolean; default `false` |
22-
| `ASYNC_FEED_REFRESH_STALE_FACTOR` | optional integer `>= 1`; default `3` |
23-
| `FEEDS_CACHE_MAX_SIZE` | optional integer `>= 1`; default `500`; maximum number of feeds to cache in memory before eviction |
24-
| `RATE_LIMIT_ENABLED` | optional boolean; default `true` (except `false` in `test`); enables or disables client IP rate limiting |
25-
| `RATE_LIMIT_MAX_REQUESTS` | optional integer `>= 1`; default `60`; maximum requests allowed per IP per window |
26-
| `RATE_LIMIT_WINDOW_SECONDS` | optional integer `>= 1`; default `60`; rate limiter sliding window duration in seconds |
27-
| `RETRY_AFTER_TIMEOUT_SECONDS` | optional integer `>= 1`; default `300`; Retry-After header backoff duration returned on timeouts |
28-
| `PORT` | app listen port; compose uses `4000` |
29-
| `RACK_ENV` | Rack environment; quickstart uses `development`, production examples use `production` |
30-
| `REQUEST_TIMEOUT_SECONDS` | optional; total web-request timeout in seconds; default `55` |
31-
| `WEB_CONCURRENCY` | optional integer `>= 1`; default `2` in production (`1` in development); number of web worker processes |
32-
| `BOTASAURUS_SCRAPE_TIMEOUT_SECONDS` | optional; HTTP client cap for POST `/scrape` in seconds; default `45`; mirrors `SCRAPE_TIMEOUT_SECONDS` on botasaurus-scrape-api |
33-
| `BOTASAURUS_SCRAPE_WORK_TIMEOUT_SECONDS` | optional; maximum `wait_timeout_seconds` in feed YAML; default `30`; mirrors `SCRAPE_WORK_TIMEOUT_SECONDS` on botasaurus-scrape-api |
34-
| `SCRAPE_WORK_TIMEOUT_SECONDS` | optional on botasaurus-scrape-api; post-boot navigate, selector wait, and scroll budget in seconds; default `30`; set on the scraper service in compose |
35-
| `HTML2RSS_TOTAL_TIMEOUT_SECONDS` | optional; internal gem feed-build timeout in seconds; default `50` |
8+
| Name | Description |
9+
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10+
| `HTML2RSS_SECRET_KEY` | required in production; development/test gets a temporary default |
11+
| `HTML2RSS_ACCESS_TOKEN` | token for the main feed-creation flow; paste the same value into the web UI when prompted |
12+
| `HEALTH_CHECK_TOKEN` | optional bearer token for authenticated `GET /api/v1/health`; not part of the first-run quickstart; use `/api/v1/health/ready` for standard readiness checks |
13+
| `BUILD_TAG` | release metadata used in logs; published Docker images set this to the release version |
14+
| `GIT_SHA` | deployed commit metadata used in logs; published Docker images set this to the released commit |
15+
| `SENTRY_DSN` | optional; enables Sentry errors/logs when set |
16+
| `BOTASAURUS_SCRAPER_URL` | optional; Botasaurus scrape API base URL (e.g. `http://botasaurus:4010`) for browser rendering and anti-bot bypass |
17+
| `AUTO_SOURCE_ENABLED` | boolean. The app default is `true` in development/test and `false` otherwise. The shipped `docker-compose.yml` (default `true`) and `docker-compose.quickstart.yml` (`true`) both enable it. |
18+
| `CONFIG_CATALOG_ENABLED` | optional boolean; default `true`. When `false`, `GET /api/v1/configs` returns `404` with `catalog_disabled`. |
19+
| `BOTASAURUS_SENTRY_DSN` | optional; read by the production compose file and passed to the botasaurus service as its own `SENTRY_DSN`. Use a separate project from `SENTRY_DSN`. |
20+
| `TLS_CERTIFICATE_PATH` / `TLS_KEY_PATH` | optional; certificate and private key paths for TLS termination inside the app. Without them, terminate TLS in a reverse proxy. |
21+
| `ASYNC_FEED_REFRESH_ENABLED` | optional boolean; default `false` |
22+
| `ASYNC_FEED_REFRESH_STALE_FACTOR` | optional integer `>= 1`; default `3` |
23+
| `FEEDS_CACHE_MAX_SIZE` | optional integer `>= 1`; default `500`; maximum number of feeds to cache in memory before eviction |
24+
| `RATE_LIMIT_ENABLED` | optional boolean; default `true` (except `false` in `test`); enables or disables client IP rate limiting |
25+
| `RATE_LIMIT_MAX_REQUESTS` | optional integer `>= 1`; default `60`; maximum requests allowed per IP per window |
26+
| `RATE_LIMIT_WINDOW_SECONDS` | optional integer `>= 1`; default `60`; rate limiter sliding window duration in seconds |
27+
| `RETRY_AFTER_TIMEOUT_SECONDS` | optional integer `>= 1`; default `300`; Retry-After header backoff duration returned on timeouts |
28+
| `PORT` | app listen port; compose uses `4000` |
29+
| `RACK_ENV` | Rack environment; quickstart uses `development`, production examples use `production` |
30+
| `REQUEST_TIMEOUT_SECONDS` | optional; total web-request timeout in seconds; default `55` |
31+
| `WEB_CONCURRENCY` | optional integer `>= 1`; default `2` in production (`1` in development); number of web worker processes |
32+
| `BOTASAURUS_SCRAPE_TIMEOUT_SECONDS` | optional; HTTP client cap for POST `/scrape` in seconds; default `45`; mirrors `SCRAPE_TIMEOUT_SECONDS` on botasaurus-scrape-api |
33+
| `BOTASAURUS_SCRAPE_WORK_TIMEOUT_SECONDS` | optional; maximum `wait_timeout_seconds` in feed YAML; default `30`; mirrors `SCRAPE_WORK_TIMEOUT_SECONDS` on botasaurus-scrape-api |
34+
| `SCRAPE_WORK_TIMEOUT_SECONDS` | optional on botasaurus-scrape-api; post-boot navigate, selector wait, and scroll budget in seconds; default `30`; set on the scraper service in compose |
35+
| `SCRAPE_DEFAULT_TIMEZONE` | optional on botasaurus-scrape-api; IANA timezone (for example `Europe/Berlin`) the browser reports when a feed sets no `timezone`; unset means UTC; an invalid id stops the service at startup |
36+
| `HTML2RSS_TOTAL_TIMEOUT_SECONDS` | optional; internal gem feed-build timeout in seconds; default `50` |
3637

3738
## Timeout Chain
3839

‎src/content/docs/web-application/reference/monitoring.mdx‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Monitoring"
3-
description: "Health endpoints and Sentry-based monitoring for html2rss-web."
3+
description: "Health endpoints, Sentry, and scraper log events for html2rss-web."
44
---
55

66
import { Code } from "@astrojs/starlight/components";
@@ -39,3 +39,22 @@ Use separate Sentry projects for html2rss-web and botasaurus-scrape-api. Never s
3939
In `docker-compose.yml`, the botasaurus service maps `BOTASAURUS_SENTRY_DSN` into its own `SENTRY_DSN`, requires it at startup, and does not fall back to the web project's DSN.
4040

4141
For on-call triage, alert rules, and dashboard baselines, see the [Sentry runbook in the web repo](https://github.com/html2rss/html2rss-web/blob/main/docs/README.md#sentry-runbook).
42+
43+
## Scraper log events
44+
45+
Sentry only receives the scraper's own failures. Outcomes on target sites go to the logs. Set `LOG_FORMAT=json` on botasaurus-scrape-api and ship its stdout to your log store, such as OpenObserve. Each line is one JSON object with an `event_name`, and events tied to a scrape carry its `request_id` and `host`.
46+
47+
| Event | Level | When |
48+
| ----------------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
49+
| `scrape_finished` | INFO, WARNING or ERROR | Once per admitted scrape (ERROR for the scraper's own failures), with tier, status, `error_category`, and the challenge `vendor`/`signal` on blocks |
50+
| `scrape_rejected` | WARNING or INFO | A request refused before scraping (SSRF, invalid proxy, unresolvable host) |
51+
| `egress_blocked` | WARNING | The page tried to reach a blocked address; logged once per host per attempt |
52+
| `egress_summary` | INFO or WARNING | Once per scrape when egress had refusals or failures; WARNING when the upstream proxy refused a tunnel or DNS timed out |
53+
54+
Useful alerts:
55+
56+
- `egress_summary` with `upstream_refused > 0`: proxy credentials or quota. `upstream_status` holds the proxy's answer, such as `407` or `402`.
57+
- `egress_summary` with `dns_timeouts > 0`: resolver trouble on the scraper host.
58+
- `egress_blocked` grouped by `host`: sites whose pages try to reach internal addresses.
59+
60+
The scrape API README lists every field.

0 commit comments

Comments
 (0)