When requesting some files under different domain names, for example: src= ' ******.svg '
Sometimes there's a hint.
Cross-origin requests have been blocked: the same-origin policy prohibits reading remote resources located at *. (Reason: CORS header is missing ' Access-control-allow-origin ').
Font from Origin ' have been blocked from loading by cross-origin Resource sharing Policy:no ' Access-control-allow-origin ' Header is present on the requested resource. Origin ' is therefore not allowed access.
This is because the server prohibits the different domain names on the file request, some pictures to prevent hotlinking is through this configuration to do;
How to separate this permission. That is, the configuration file allows access to certain domain names.
The following are examples of Apache Nginx and IIS respectively
①nginx
Open the configuration file, configure Eot|otf|ttf|woff|svg and other files, allow access to all domain names, of course, you can also replace * to allow access to the domain name;
Example: www.baidu.com
Location ~* \. (Eot|otf|ttf|woff|svg) $ {
Add_header Access-control-allow-origin *;
}
Restart Nginx test
②apache
First edit httpd.conf
Find this line.
#LoadModule Headers_module modules/mod_headers.so
Remove the # comment
LoadModule Headers_module modules/mod_headers.so
To open the Apache header information Custom module
Then add a row to the virtual host for the standalone resource domain name
Header Set Access-control-allow-origin *
Restart Apache trial
③iis7
Open IIS, select the project, select Feature View on the right
Iis->http response Header (top right) actions, add
Name: Access-control-allow-origin
Value: *
OK, restart IIS, try
That should be it.