cómo configurar el encabezado Http X-XSS-Protection


He tratado de poner esto:

   <meta http-equiv="X-XSS-Protection" content="0">

En la etiqueta <head> pero no han tenido suerte. Estoy tratando de deshacerse de ES decir molesto prevención de scirpting cross-site

Author: Aly, 2011-01-08

6 answers

Dudo que funcione como una meta etiqueta. Es posible que tenga que decirle a su servidor web que lo envíe como un encabezado real.

En PHP, lo harías como

header("X-XSS-Protection: 0");

En ASP.net:

Response.AppendHeader("X-XSS-Protection","0")

En la configuración de Apache:

Header set  X-XSS-Protection  0

En IIS, hay una sección en las propiedades para encabezados adicionales. A menudo tiene "X-Powered-By: ASP.NET" ya está configurado en él; simplemente agregaría "X-XSS-Protection: 0" a ese mismo lugar.

 38
Author: cHao,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-01-08 18:58:55

Si está utilizando.Net MVC puede configurarlo a través de customHeaders en Web.Config.

Para agregar estos encabezados, vaya al nodo httpprotocol y agregue esos encabezados dentro del nodo customHeaders.

<httpprotocol> 
    <customheaders> 
        <remove name="X-Powered-By"> 
           <add name="X-XSS-Protection" value="1; mode=block"></add>
        </remove>
    </customheaders> 
</httpprotocol>

Recomiendo encarecidamente este enlace que explica cómo puede configurar los encabezados de respuesta de IIS Seguros en ASP.NET MVC: http://insiderattack.blogspot.com/2014/04/configuring-secure-iis-response-headers.html

 12
Author: equiman,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-09 16:40:25

En algunos casos, si usa .htaccess, necesita usar comillas dobles:

Header set x-xss-protection "1; mode=block"

 2
Author: gbm,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-07-17 13:26:31

En ASP Classic, esta etiqueta lo hará:

<% Response.AddHeader "X-XSS-Protection", "1" %>
 2
Author: Hernaldo Gonzalez,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-05-05 10:21:54

En Apache, necesita editar el archivo de configuración, este archivo podría ser:

/etc / apache2 / apache2.conf

/etc / apache2 / httpd.conf

En el archivo puede agregar estas líneas al final para habilitar la protección HTTP Header XSS:

<IfModule mod_headers.c>
    Header set X-XSS-Protection: "1; mode=block"
</IfModule>

Nota: si mod_headers es externo al núcleo principal de Apache (no compilado en Apache) entonces usarías .so en lugar de .c - ie. <IfModule mod_headers.so>

Después de eso, guarde los cambios y reinicie apache con:

Sudo service apache2 restart

O

Sudo service httpd restart

Espero que esto ayude! :)

 1
Author: galoget,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-12-23 01:45:49
# Turn on IE8-IE9 XSS prevention tools
Header set X-XSS-Protection "1; mode=block"

Este encabezado es exclusivo de Internet Explorer 8 y 9, activa la protección de scripts de sitios cruzados en IE 8 e IE 9, que está desactivada por defecto, ya que podría romper algunos sitios web. Para activar el filtro XSS, utilice el encabezado X-XSS-Protection "1; mode = block". Si desea evitar que este filtro se active para su sitio web, establezca el valor de los encabezados en "0";

Http://stopmalvertising.com/security/securing-your-website-with-.htaccess/.htaccess-http-headers.html

 0
Author: Won Jun Bae,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-10-21 18:20:39