Request header field Access-Control-Allow-Headers is not allowed by Access-Control-Allow-Headers in preflight response

后端 未结 1 864
死守一世寂寞
死守一世寂寞 2020-12-11 16:47

I am trying to make a login page from cross domain but I couldn\'t solve the problem, the error is:

XMLHttpRequest cannot load http://localhost/testin

相关标签:
1条回答
  • 2020-12-11 17:08

    remove this:

    headers: {"Access-Control-Allow-Headers": "Content-Type"},
    

    from your jQuery.ajax call.

    The server responds with a Access-Control-Allow-Headers header, the client doesn't send it to the server.

    The client sends a Access-Control-Request-Headers to request allowing certain headers, the server responds back with with a Access-Control-Allow-Headers that lists the actual headers its going to allow. The client does not get to demand what headers are allowed.

    0 讨论(0)
提交回复
热议问题