elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Recuerda que debes registrarte en el foro para poder participar (preguntar y responder)


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web (Moderador: #!drvy)
| | |-+  [Resuelto] fuentes bloqueadas en cliente web - CORS
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Resuelto] fuentes bloqueadas en cliente web - CORS  (Leído 4,030 veces)
gAb1


Desconectado Desconectado

Mensajes: 731


Ver Perfil
[Resuelto] fuentes bloqueadas en cliente web - CORS
« en: 18 Octubre 2015, 14:18 pm »

Hola buenas, ¿alguien sabe que es eso de CORS? estoy viendo en la consola de firefox que se esta bloqueando las fuentes de mi web (en un hosting, en local funciona bien).

Las fuentes (y css, js, etc) están en un subdominio, ya que las url son procesadas por el index.php y no funcionan las rutas en el dominio.

Citar
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at /fonts/Oxygen-Regular.ttf. (Reason: CORS header 'Access-Control-Allow-Origin' missing). <unknown>
downloadable font: download failed (font-family: "Oxygen-Regular" style:normal weight:normal stretch:normal src index:0): bad URI or cross-site access not allowed source: /fonts/Oxygen-Regular.ttf styles.css:10:12
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at /fonts/Montserrat-Regular.ttf. (Reason: CORS header 'Access-Control-Allow-Origin' missing). <unknown>
downloadable font: download failed (font-family: "Montserrat-Regular" style:normal weight:normal stretch:normal src index:0): bad URI or cross-site access not allowed source: /fonts/Montserrat-Regular.ttf styles.css:6:12
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at /fonts/glyphicons-halflings-regular.woff2. (Reason: CORS header 'Access-Control-Allow-Origin' missing). <unknown>
downloadable font: download failed (font-family: "Glyphicons Halflings" style:normal weight:normal stretch:normal src index:1): bad URI or cross-site access not allowed source: /fonts/glyphicons-halflings-regular.woff2 bootstrap.css:267:12
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at /fonts/glyphicons-halflings-regular.woff. (Reason: CORS header 'Access-Control-Allow-Origin' missing). <unknown>
downloadable font: download failed (font-family: "Glyphicons Halflings" style:normal weight:normal stretch:normal src index:2): bad URI or cross-site access not allowed source: /fonts/glyphicons-halflings-regular.woff bootstrap.css:267:12
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at /fonts/glyphicons-halflings-regular.ttf. (Reason: CORS header 'Access-Control-Allow-Origin' missing). <unknown>
downloadable font: download failed (font-family: "Glyphicons Halflings" style:normal weight:normal stretch:normal src index:3): bad URI or cross-site access not allowed source: /fonts/glyphicons-halflings-regular.ttf bootstrap.css:267:12

He estado leyendo sobre el problema y me parece que hay que activar en el hosting algo sobre CORS pero he estado viendo (en kloxo) y no veo nada parecido.

¿Alguien sabe como solucionar esto?

Gracias!

Edito: Acaba de encontrar la web enable-cors.org pero parece que no funciona... ya he añadido el header al archivo .htaccess (ya que no se como acceder desde kloxo a archivos conf de apache).

Así es como lo tengo actualmente, pero no funciona de ninguna de las maneras (tal vez hay que reiniciar apache o esperar mas?):

Código:
Options -Indexes

Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"

DirectoryIndex index.php

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


« Última modificación: 29 Octubre 2015, 21:36 pm por gAb1 » En línea

MinusFour
Moderador Global
***
Desconectado Desconectado

Mensajes: 5.529


I'm fourth.


Ver Perfil WWW
Re: fuentes bloqueadas en cliente web - CORS
« Respuesta #1 en: 18 Octubre 2015, 15:27 pm »

La instrucción de "Header add" no figura en la documentación de mod_headers.  Solo "Header set". Necesitas también cargar mod_headers (no se si tu hosting lo tenga activado). Este header tiene que ser aplicado sobre la carpeta que tiene el root del subdominio.

Edit: Header add si figura en la documentación pero:

Citar
add
    The response header is added to the existing set of headers, even if this header already exists. This can result in two (or more) headers having the same name. This can lead to unforeseen consequences, and in general set, append or merge should be used instead.


« Última modificación: 18 Octubre 2015, 15:43 pm por MinusFour » En línea

gAb1


Desconectado Desconectado

Mensajes: 731


Ver Perfil
Re: fuentes bloqueadas en cliente web - CORS
« Respuesta #2 en: 18 Octubre 2015, 15:31 pm »

Ah la carpeta root del subdominio... Gracias voy a probar (solo con header set).

Gracias ahora ya funcionan las fuentes!
« Última modificación: 18 Octubre 2015, 15:39 pm por gAb1 » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
misiones bloqueadas
Juegos y Consolas
cmcmc 2 1,751 Último mensaje 9 Mayo 2006, 00:22 am
por pliskin007
Acceder a paginas bloqueadas
Redes
diiaz2910 0 1,875 Último mensaje 22 Septiembre 2012, 06:32 am
por diiaz2910
[Resuelto] Sitios para saltarme CORS desde javascript o algún workaround? « 1 2 »
Desarrollo Web
@XSStringManolo 10 3,787 Último mensaje 29 Agosto 2019, 21:09 pm
por MinusFour
Error con AJAX Solicitud CORS no exitosa
Desarrollo Web
SrTrp 5 4,300 Último mensaje 28 Abril 2021, 23:34 pm
por WHK
Direcciónes Bloqueadas « 1 2 »
Dudas Generales
B€T€B€ 14 7,042 Último mensaje 4 Octubre 2021, 23:25 pm
por fzp
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines