我有带有Express后端的React应用程序,所有请求都通过Apache Web服务器进行。我正在尝试从React应用程序向Express后端进行Ajax调用(使用Fetch)。后端进行一些安全处理,然后应将响应重定向到第三方网站。这会导致CORS错误:
Access to fetch at <3rdPARTY_SITE> (redirected from <MY_URL>) from origin 'https://localhost:3000' 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.
我可以将URL恢复到React应用程序并使用window.location.href
访问该站点,但是我还必须发送带有响应的cookie。有什么想法可以解决这个问题吗?