search

Home  >  Q&A  >  body text

How to solve the problem of CORS policy blocking redirects

<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粉824889650P粉824889650518 days ago568

reply all(2)I'll reply

  • P粉593536104

    P粉5935361042023-08-22 09:57:28

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

    Allow CORS: Access-Control-Allow-Origin

    reply
    0
  • P粉998100648

    P粉9981006482023-08-22 00:19:11

    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 .

    reply
    0
  • Cancelreply