How to get "request.mode" from Cloudflare Worker?

I’m developing the code for a Cloudflare Worker. I need to check the “request.mode” of the request: Request.mode - Web APIs | MDN

For example, if request.mode === navigate, then do X.

However, when I try to evaluate that request param, I get the following error: Failed to get the ‘mode’ property on ‘Request’: the property is not implemented

Meaning, the Cloudflare request object does not contain the “request.mode”.

Is there a way to get that from the Cloudflare Worker code?

Cloudflare Workers run server-side and cannot know the request mode used by the browser.

There is also no concept of CORS in Cloudflare Workers. You can freely send requests to any domain.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.