During security check, its reported that “The Content-Type HTTP header is missing charset attribute” is missing for js and css file.
Please check below screenshot:
My HTML Was look like below before i have added the charset
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <script type="text/javascript" src="/backend/web/assets/3faf0a44/jquery.js"></script> </head> </html>
Then i have added the charset=”UTF-8″ in
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <script type="text/javascript" src="/backend/web/assets/3faf0a44/jquery.js" charset="UTF-8"></script> </head> </html>
Still Charset is not added in Response Header, Please check below screenshot:
So what should i do so my Content-Type header changed to below:
content-type: application/javascript; charset=utf-8
Advertisement
Answer
Let me try to answer, you can do that by editing apache2.conf
(for Debian like OS(es) ) or httpd.conf
( CentOS like OS(es) ) and add following lines:
#Set the correct Char set so don't need to set it per page. AddDefaultCharset utf-8 #for css, js, etc. AddCharset utf-8 .htm .html .js .css
Source: