Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

uweb browser should make life easier, but still one step from ms-copilot #45

Open
torappinfo opened this issue Dec 3, 2024 · 0 comments

Comments

@torappinfo
Copy link

torappinfo commented Dec 3, 2024

uweb browser supports global redirection with cookie forwarding. Thus cf worker easily works for AI sites like devv.ai and duck.ai. It works for most sites allowing visits from cloudflare worker. The ms copilot is the only one that fails me, other sites like perplexity.ai are blocking cloudflare worker visiting.

I am using the cf worker code as follows:

export default {
  async fetch(req, _env) {
    let url = req.url;
    const Url = new URL(url);
    let iSlash = url.indexOf('/',11);
    let nUrl = url.substring(iSlash+1);
    return await goUrl(req, nUrl);
  }
}
async function goUrl(request, url) {
  const Url = new URL(url);
  let headers = new Headers(request.headers);
  headers.set("X-forwarded-for","104.28.5.161");
  const newReq = new Request(Url, {
    method: request.method,
    headers: headers,
    body: request.body
  })
  return await fetch(newReq);
}

In the above code, only

  headers.set("X-forwarded-for","104.28.5.161");

matters for copilot to work. All the other code in this repository should not be needed since uweb browser is visiting the original ms site (the traffic is through cf worker but the browser has no knowledge of it).

EDIT: After more research, it seems no clean solution for copilot. Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant