This error occurs when a web application running on 'http://localhost:3000' tries to make a XMLHttpRequest to 'https://mcbox.mynavi.jp/corp/submission-content/list/' but is blocked due to the CORS (Cross-Origin Resource Sharing) policy.

The CORS policy is a security mechanism implemented by web browsers to prevent cross-origin requests (requests from different domains) unless the server explicitly allows it.

In this case, the server at 'https://mcbox.mynavi.jp' does not include the 'Access-Control-Allow-Origin' header in its response, which specifies the allowed origins that can access its resources. Since the header is missing, the browser blocks the request.

To resolve this issue, you have a few options:

  1. If you have control over the server at 'https://mcbox.mynavi.jp', you can modify its configuration to include the 'Access-Control-Allow-Origin' header with the value of 'http://localhost:3000'. This will allow requests from 'http://localhost:3000' to access the server's resources.

  2. If you don't have control over the server, you can create a proxy server on your 'http://localhost:3000' domain that forwards the request to 'https://mcbox.mynavi.jp'. This way, the request will be considered as a same-origin request and won't be blocked by the browser's CORS policy.

  3. If the server supports JSONP (JSON with Padding), you can use JSONP instead of XMLHttpRequest. JSONP allows cross-origin requests by dynamically adding a '<script>' tag to the document.

  4. If none of the above options are feasible, you may need to contact the server's administrator or API provider to inquire about their CORS policy and if they can allow requests from 'http://localhost:3000'.

It's important to note that bypassing the CORS policy can introduce security risks, so make sure to consider the implications and follow best practices when implementing any of the above solutions.


原文地址: https://www.cveoy.top/t/topic/pFYm 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录