0

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.

JLLMNCHR
  • 1,551
  • 5
  • 24
  • 50
  • Does this answer your question? [What is "X-Content-Type-Options=nosniff"?](https://stackoverflow.com/questions/18337630/what-is-x-content-type-options-nosniff) (e.g. do your servlets actually generate a header that declares the correct content type, or was it sniffied until now?) – Olaf Kock May 09 '22 at 13:38

1 Answers1

0

Finally, for me, this do the job:

httpServletResponse.setContentType("text/html;charset=ISO-8859-1");
JLLMNCHR
  • 1,551
  • 5
  • 24
  • 50