Home > Mobile >  Servlet html generated code is shown as plain text after nosniff added to httpd.conf file
Servlet html generated code is shown as plain text after nosniff added to httpd.conf file

Time:05-18

After adding the following line to our Apache httpd.conf configuration file, the html code generated by our servlets is not interpreted correctly by the browser, but its html code is displayed as plain text:

Header set X-Content-Type-Options nosniff

From nothing to served add the following header to the code generated by the servlets:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

Neither with this works:

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1; X-Content-Type-Options=nosniff" />

Any help will be appreciated.

CodePudding user response:

Finally, for me, this do the job:

httpServletResponse.setContentType("text/html;charset=ISO-8859-1");
  • Related