Skip to content

fix: allow Bing engine to follow HTTP redirects (301)#95

Open
XVOYOVX wants to merge 1 commit into
Aas-ee:mainfrom
XVOYOVX:fix/bing-redirect-follow
Open

fix: allow Bing engine to follow HTTP redirects (301)#95
XVOYOVX wants to merge 1 commit into
Aas-ee:mainfrom
XVOYOVX:fix/bing-redirect-follow

Conversation

@XVOYOVX
Copy link
Copy Markdown

@XVOYOVX XVOYOVX commented May 31, 2026

Problem

Bing searches fail with a timeout when cn.bing.com returns a 301 redirect to www.bing.com. This affects users behind proxies or in regions where cn.bing.com redirects.

Root Cause

In src/engines/bing/bing.ts, the buildBingAxiosRequestOptions() function sets trustedStaticHost: true. In src/utils/httpRequest.ts, this forces maxRedirects: 0, preventing the HTTP client from following any redirects.

// httpRequest.ts:73
const effectiveMaxRedirects = trustedStaticHost ? 0 : maxRedirects;

cn.bing.com/search returns a 301 → www.bing.com, but with maxRedirects: 0 the request fails silently and eventually times out.

Fix

Changed trustedStaticHost: true to trustedStaticHost: false in buildBingAxiosRequestOptions(), allowing Bing requests to follow redirects (up to 5 hops by default), consistent with the behavior of fetchWebContent.

Testing

Verified locally: after the fix, open-websearch search "test" --engine bing returns results successfully instead of timing out.

cn.bing.com returns a 301 redirect to www.bing.com, but the Bing
engine was configured with `trustedStaticHost: true`, which forces
`maxRedirects: 0` in the HTTP request layer. This caused all Bing
searches to fail with a timeout error for users behind proxies or
in regions where cn.bing.com redirects.

Changed `trustedStaticHost` from `true` to `false` so that Bing
requests follow redirects (up to 5 hops by default), matching the
behavior of other search engines.
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