[GH-ISSUE #12] cors hatası #9

Closed
opened 2026-02-26 04:36:10 +03:00 by kerem · 2 comments
Owner

Originally created by @zafer06 on GitHub (Mar 19, 2020).
Original GitHub issue: https://github.com/melihkorkmaz/il-ilce-mahalle-geolocation-rest-api/issues/12

axios veya fetch api ile "https://il-ilce-rest-api.herokuapp.com/v1/cities" adresinden veri almaya çalıştığımda aşağıdaki hatayı alıyorum.

Access to fetch at 'https://il-ilce-rest-api.herokuapp.com/v1/cities' from origin 'http://127.0.0.1:8080' has been blocked by CORS policy: 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.

Originally created by @zafer06 on GitHub (Mar 19, 2020). Original GitHub issue: https://github.com/melihkorkmaz/il-ilce-mahalle-geolocation-rest-api/issues/12 axios veya fetch api ile "https://il-ilce-rest-api.herokuapp.com/v1/cities" adresinden veri almaya çalıştığımda aşağıdaki hatayı alıyorum. ``` Access to fetch at 'https://il-ilce-rest-api.herokuapp.com/v1/cities' from origin 'http://127.0.0.1:8080' has been blocked by CORS policy: 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.```
kerem closed this issue 2026-02-26 04:36:10 +03:00
Author
Owner

@Pasinli commented on GitHub (Mar 20, 2020):

var proxyUrl = 'https://cors-anywhere.herokuapp.com/', targetUrl = 'https://il-ilce-rest-api.herokuapp.com/v1/cities' fetch(proxyUrl + targetUrl) .then(blob => blob.json()) .then(data => { return data; }) .catch(e => { return e; });

<!-- gh-comment-id:601588021 --> @Pasinli commented on GitHub (Mar 20, 2020): ` var proxyUrl = 'https://cors-anywhere.herokuapp.com/', targetUrl = 'https://il-ilce-rest-api.herokuapp.com/v1/cities' fetch(proxyUrl + targetUrl) .then(blob => blob.json()) .then(data => { return data; }) .catch(e => { return e; });`
Author
Owner

@zafer06 commented on GitHub (Mar 21, 2020):

Teşekkürler @Pasinli gönderdiğin kodlar işe yaradı. Ancak merak ediyorum bu soruna api tarafında bir çözüm bulunması daha doğru olmaz mıydı?

<!-- gh-comment-id:601998916 --> @zafer06 commented on GitHub (Mar 21, 2020): Teşekkürler @Pasinli gönderdiğin kodlar işe yaradı. Ancak merak ediyorum bu soruna api tarafında bir çözüm bulunması daha doğru olmaz mıydı?
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/il-ilce-mahalle-geolocation-rest-api-melihkorkmaz#9
No description provided.