Getting 404 error on POST. Angular.js

前端 未结 1 1687
心在旅途
心在旅途 2021-01-15 16:33

new to Angular and javascript. I am using Angular to connect to a service on a different server. I am able to get data just fine, but when I am trying to post, I get a 404.

相关标签:
1条回答
  • 2021-01-15 16:57

    It looks like it was something on the server side configuration. We had set the Access-Control-Allow-Origin to *. According to the answer below, Chrome no longer supports that.

    Original (wrong):

    header("Access-Control-Allow-Headers: *");
    

    Corrected:

    header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
    

    For more information check out this post. https://stackoverflow.com/a/18192705/3010896

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