Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

288
Views
CORS error when querying backend The Same Origin Policy disallows reading the remote resource

my svelte code is:

<script lang="ts">
    import { onMount } from "svelte";    
    let qdata = Object;
    let url = "";
    onMount(() => {
        url = "http://127.0.0.1:8000/apisearch/".concat(window.location.href.substr(31));
        fetch(url)
        .then(res => res.json())
        .then(dat => console.log(dat));
    }); //get query
    let h = "http://127.0.0.1:8000/apisearch/".concat(url);
</script>
{url}

<div class="grid justify-center rounded bg-slate-500">
    {#each qdata as result}
        <p>{result}</p>
    {/each}
</div>

The error I get is Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:8000/apisearch/test. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200. My backend is built in rust with the rocket framework. I am using sveltekit.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!