Edge on Windows 10 32-Bit blocking ajax call to localhost with Network Error 0x2efd

后端 未结 5 1517
耶瑟儿~
耶瑟儿~ 2021-02-07 11:31

We have an app that uses SignalR to talk to scanner drivers locally that has been in production for a couple of years working on IE, Chrome and Firefox, which do not have a prob

5条回答
  •  后悔当初
    2021-02-07 12:25

    I had similar problem with Edge. The fix needed changes in ajax call and server running at localhost.

    In ajax call I had to change from old text/plain to application/json

    contentType: 'application/json; charset=utf-8',
    

    Local server was using Jersey so there I added ContainerResponseFilter implementation that adds Access-Control-Allow-Headers and Access-Control-Allow-Methods headers. Access-Control-Allow-Origin was in place already.

    res.getHeaders().add("Access-Control-Allow-Headers", "origin, content-type, accept, authorization");
    res.getHeaders().add("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
    

提交回复
热议问题