http://site-a.com
and requests an image, but the image is hosted on another server and has the path http://cdn.site-b.com/image.jpg
, the user’s browser sends a request to the server http://cdn.site-b.com/
:
http://site-a.com
. The http://cdn.site-b.com
server checks the “Origin” header and decides whether to accept or deny the request.
http://cdn.site-b.com
server is configured for cross-platformed requests, it will add the CORS header with the allowing value (e.g., Access-Control-Allow-Origin: *) to the response. In this case, the requested image will be displayed at http://site-a.com
.http://cdn.site-b.com
server isn’t configured for cross-platformed requests, the response will have no “Access-Control-Allow-Origin” header or won’t have permission for http://site-a.com
, and the requested image will not be displayed.*, for all domains
'$http_origin' if an origin is listed below
'$http_origin', for all domains
http://cdn.testdomain.com/assets/image.jpg
is a link to your file delivered via CDN.
3. In the output, check whether the “Access-Control-Allow-Origin” header is present. If you see the Access-Control-Allow-Origin header in the response, the configuration was successful.