How to fix "Redirect blocked by CORS policy: No 'Access-Control-Allow-Origin' header"?
P粉420958692
P粉420958692 2023-08-23 13:18:14
0
2
509

I'm developing an application using Vue js. Based on my setup, I need to pass variables to my URL when the settings change.

 $.get('http://172.16.1.157:8002/firstcolumn/' c1v '/' c1b, function (data) { // some code... }); 

But when my app clicks on the URL, it displays the following message.

Failed to load http://172.16.1.157:8002/firstcolumn/2017-03-01/2017-10-26: Redirect from 'http:/ /172.16.1.157:8002/firstcolumn/2017-03-01/2017-10-26' to 'http://172.16.1.157:8002/firstcolumn/2017-03-01/2017-10-26/' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.


P粉420958692
P粉420958692

reply all (2)
P粉239089443

Thank you everyone, I solved it through this extension on Chrome.

Allow CORS: Access-Control-Allow-Origin一个>

    P粉748218846

    In addition to having the person responsible for the server reconfigure as awd mentioned (an impractical solution for local development), I also used a change source chrome plugin like this:

    1. Moesif Orign and CORS Converter (used to be free but now want a work email address>_>)
    2. Allow CORS: Access-Control-Allow-Origin (Testing 2023)

    You can make yourlocal development server (eg: localhost:8080)appear to be coming from172.16.1.157:8002 or any other domain.

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!