CORS ERROR

Yesterday the api was fine but today it gives me cors error ?

What is your host name.

Only localhost is allowed

localhost:3000 :( zeevy please help me i have a case study from a company. I have to use your api and complete the project in 2 days but im getting error now.

Access to fetch at 'https://gorest.co.in/v2/users' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

access-control-allow-origin: http://localhost:3000 is allowed

are you using wrong url "https://gorest.co.in/v2/users" instead of "https://gorest.co.in/public/v2/users"

curl -X GET -H "Origin: http://localhost:3000" -I https://gorest.co.in/public/v2/users HTTP/2 200 date: Mon, 20 Mar 2023 14:15:05 GMT content-type: application/json; charset=utf-8 access-control-allow-methods: GET, POST, DELETE, PUT, OPTIONS, PATCH, HEAD access-control-allow-origin: http://localhost:3000 access-control-expose-headers: x-links-current, x-links-next, x-links-previous, x-pagination-limit, x-pagination-page, x-pagination-pages, x-pagination-total, x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-reset access-control-max-age: 7200 cache-control: max-age=0, private, must-revalidate etag: W/"aac6177c56a50c567f372abcda3eb881" referrer-policy: strict-origin-when-cross-origin vary: Origin x-content-type-options: nosniff x-download-options: noopen x-frame-options: SAMEORIGIN x-links-current: https://gorest.co.in/public/v2/users?page=1 x-links-next: https://gorest.co.in/public/v2/users?page=2 x-links-previous: x-pagination-limit: 10 x-pagination-page: 1 x-pagination-pages: 248 x-pagination-total: 2480 x-permitted-cross-domain-policies: none x-request-id: 78cd5218-3bfd-4fd5-929c-de0c191ba05d x-runtime: 0.055649 x-xss-protection: 0 cf-cache-status: DYNAMIC report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=Ep%2Fj2yyll%2B%2BlBc7byCGA6HKTejJS1V6C6eOlMA4KhpPQA%2BeDgJDQAs04O2hOqEvgB4%2ByXsL%2FcNCrJ%2BmgegWmFdDiLz4D%2FxRQpEpoW7I7baLyy4Y5KQCjzhAhPe5kFCo%3D"}],"group":"cf-nel","max_age":604800} nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800} server: cloudflare cf-ray: 7aae90b34f1f2e85-HYD alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

Yes, that was the problem. Thank you very much and I apologize for taking up your time.


Little markdown supported