Heim  >  Artikel  >  Backend-Entwicklung  >  在阿里云ecs上部署WordPress时,遇到一个同源策略问题

在阿里云ecs上部署WordPress时,遇到一个同源策略问题

WBOY
WBOYOriginal
2016-06-06 20:15:491267Durchsuche

在阿里云ecs上部署WordPress时,遇到一个同源策略问题。当前使用的wp主题使用了主题自带的字体文件,当使用ip地址直接访问时,字体文件可以正常加载,但换到域名访问时就出现了跨源请求资源的问题。
windows下的firefox,chrome都出现了上述问题,但是移动端访问正常。

下面贴出浏览器console记录

<code>22:51:46.885 已拦截跨源请求:同源策略禁止读取位于 http://120.27.100.154/blog/wp-content/themes/Puma-plus-master/static/fonts/icomoon.ttf?jh4rkv 的远程资源。(原因:CORS 头缺少 'Access-Control-Allow-Origin')。1 </code>

回复内容:

在阿里云ecs上部署WordPress时,遇到一个同源策略问题。当前使用的wp主题使用了主题自带的字体文件,当使用ip地址直接访问时,字体文件可以正常加载,但换到域名访问时就出现了跨源请求资源的问题。
windows下的firefox,chrome都出现了上述问题,但是移动端访问正常。

下面贴出浏览器console记录

<code>22:51:46.885 已拦截跨源请求:同源策略禁止读取位于 http://120.27.100.154/blog/wp-content/themes/Puma-plus-master/static/fonts/icomoon.ttf?jh4rkv 的远程资源。(原因:CORS 头缺少 'Access-Control-Allow-Origin')。1 </code>

问题已解决,WordPress忘了将地址改过来了,之前是将IP作为地址的

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn