我正在构建一个也需要chrome扩展的Web API服务器。 Chrome扩展程序需要显示一个登录表单。但是我得到这个错误:
Access to fetch at '<api>' from origin 'chrome-extension://aielmfnoimpkelebjpjohefjiikgamol' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
我需要在服务器和扩展之间进行大量交互。此问题是阻止者。该API是REST,我需要GET,POST,PATCH,PUT才能正常工作。
该如何解决?我可以在服务器上设置Allow Origin
策略吗?