How do I fix the CORS problem?

  • 0
    Hello everyone.

    There was a problem with CORS headers.
    The essence of the problem. Three requests to the same server. All three requests respond to OPTIONS with the same cors headers. One of the requests crashes with a browser error due to the lack of cors headers, although they are present in the next OPTIONS request for the same route in the browser.

    If you need add. information - in the comments.

    access-control-allow-headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization
    access-control-allow-methods: GET, POST, OPTIONS
    access-control-allow-origin: *
    access-control-max-age: 1728000
    JavaScript Anonymous, May 18, 2020

  • 1 Answers
  • 0
    Add the following directive to htaccess:

    Header set Access-Control-Allow-Origin '*'

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!