Cors
Cors
to Advanced)
(Beginners
Origin
GET XCSS
Domain-X.com
Client
Origin: GET
Domaln-Y.com
Domain-X.com
Browser
example.com
JavaScript Server
request
fetch(api.example.com/func) Ifunc endpoint
response
Blocked
Solution: CORS
(Cross-Origin Resource Sharing)
CORS is like a
permission system that lets
your server decide:
1.Which websites can access your data.
2.What types of requests (GET, POST, PUT,
DELETE) are allowed.
3.What data (headers) can be shared.
Enable CORS in the Backend
Origin
xdomain.com
GET font.wotf
Origin: xdomain.com
Access-Contro-Allow-Origin:
Other Domain
ydomain.com