How to solve the problem of CORS policy blocking redirects
P粉824889650
P粉824889650 2023-08-21 11:11:10
0
2
527
<p>I'm developing an application using <code>Vue js</code>. Based on my setup, I need to pass a variable to my URL when the settings change. </p> <pre class="lang-js prettyprint-override"><code><!-- language: lang-js --> $.get('http://172.16.1.157:8002/firstcolumn/' c1v '/' c1b, function (data) { // some code... }); </code></pre> <p>But when my application accesses the URL, the following message is displayed. </p> <pre class="brush:php;toolbar:false;">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 CORS policy blocking: There is no 'Access-Control-Allow-Origin' header on the requested resource. Therefore, access to source 'http://localhost:8080' is not allowed. </pre></p>
P粉824889650
P粉824889650

reply all(2)
P粉593536104

Thanks to everyone, I solved the problem with this extension on my Chrome browser.

Allow CORS: Access-Control-Allow-Origin

P粉998100648

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

  1. Moesif Orign & CORS Changer (used to be free, now requires work email address >_>)
  2. Allow CORS: Access-Control-Allow-Origin (tested in 2023)

You can make your local development server (eg: localhost:8080) appear to come from 172.16.1.157:8002 or any other domain name .

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!