search

Home  >  Q&A  >  body text

How to fix "Redirect blocked by CORS policy: No 'Access-Control-Allow-Origin' header"?

<p>I'm developing an application using <code>Vue js</code>. Based on my setup, I need to pass variables 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 app clicks on the URL, it displays the following message. </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 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.</pre> <p><br /></p>
P粉420958692P粉420958692458 days ago560

reply all(2)I'll reply

  • P粉239089443

    P粉2390894432023-08-24 09:25:36

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

    Allow CORS: Access-Control-Allow-Origin

    reply
    0
  • P粉748218846

    P粉7482188462023-08-24 09:19:17

    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< /a> (Testing 2023)

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

    reply
    0
  • Cancelreply