Browser MIME Type 问题

最近在升级一个第三方的web项目,过程不是太顺利,升级后,访问页面,出现以下错误:

Browser MIME Type 问题_第1张图片


复制成文本,大概是这样:

Refused to execute script from'http://localhost:8699/jw/js/jquery/jquery-1.9.1.min.js' because its MIMEtype ('') is not executable, and strict MIME type checking is enabled.



我的web环境的服务器是Solaris,用的容器是weblogic(10.3.6.0)


上述的项目在其它容器是没有问题出现的。



-------------------------------------------------------------------------------------------------------------------------


最后找到解决方案:

由于新版项目的代码考虑到安全问题,使用了

response.setHeader("X-Content-Type-Options","nosniff");


来限定MIME Type,而Weblogic这个版本,默认是没有提供这些MIME TYPE的,


所以需要在以下  目录

${weblogic_install_dir}/Oracle/Middleware/user_projects/domains/${Your_domain}/config

下,建一个mimemappings.properties来指定允许使用的MIME TYPE


比如:


js=application/javascript
css=text/css
png=image/png
jpg=image/jpeg
gif=image/gif



之后,重启weblogic得到解决。



---------------------------------------------------------

下面列出一些常用的MIME TYPE供大家参考:

application/envoy=evy
application/fractals=fif
application/futuresplash=spl
application/hta=hta
application/internet-property-stream=acx
application/mac-binhex40=hqx
application/msword=doc
application/octet-stream=*
application/oda=oda
application/olescript=axs
application/pdf=pdf
application/pics-rules=prf
application/pkcs10=p10
application/pkix-crl=crl
application/postscript=ps
application/rtf=rtf
application/set-payment-initiation=setpay
application/set-registration-initiation=setreg
application/vnd.ms-excel=xls
application/vnd.ms-outlook=msg
application/vnd.ms-pkicertstore=sst
application/vnd.ms-pkiseccat=cat
application/vnd.ms-pkistl=stl
application/vnd.ms-powerpoint=ppt
application/vnd.ms-project=mpp
application/vnd.ms-works=wps
application/winhlp=hlp
application/x-bcpio=bcpio
application/x-cdf=cdf
application/x-compress=z
application/x-compressed=tgz
application/x-cpio=cpio
application/x-csh=csh
application/x-director=dir
application/x-dvi=dvi
application/x-gtar=gtar
application/x-hdf=hdf
application/x-internet-signup=isp
application/x-iphone=iii
application/x-javascript=js
application/x-gzip=gz
application/x-latex=latex
application/x-msaccess=mdb
application/x-mscardfile=crd
application/x-msclip=clp
application/x-msdownload=dll
application/x-msmediaview=mvb
application/x-msmetafile=wmf
application/x-msmoney=mny
application/x-mspublisher=pub
application/x-msschedule=scd
application/x-msterminal=trm
application/x-mswrite=wri
application/x-netcdf=cdf
application/x-perfmon=pma
application/x-pkcs12=pfx
application/x-pkcs7-certificates=spc
application/x-pkcs7-certreqresp=p7r
application/x-pkcs7-mime=p7m
application/x-pkcs7-signature=p7s
application/x-sh=sh
application/x-shar=shar
application/x-shockwave-flash=swf
application/x-stuffit=sit
application/x-sv4cpio=sv4cpio
application/x-sv4crc=sv4crc
application/x-tar=tar
application/x-tcl=tcl
application/x-tex=tex
application/x-texinfo=texi
application/x-troff=tr
application/x-troff-man=man
application/x-troff-me=me
application/x-troff-ms=ms
application/x-ustar=ustar
application/x-wais-source=src
application/x-x509-ca-cert=cer
application/ynd.ms-pkipko=pko
application/zip=zip
application/json=json
audio/basic=au
audio/mid=mid
audio/mpeg=mp3
audio/x-aiff=aiff
audio/x-mpegurl=m3u
audio/x-pn-realaudio=ram
audio/x-wav=wav
image/bmp=bmp
image/cis-cod=cod
image/gif=gif
image/ief=ief
image/jpeg=jpg
image/pipeg=jfif
image/svg+xml=svg
image/tiff=tif
image/x-cmu-raster=ras
image/x-cmx=cmx
image/x-icon=ico
image/x-portable-anymap=pnm
image/x-portable-bitmap=pbm
image/x-portable-graymap=pgm
image/x-portable-pixmap=ppm
image/x-rgb=rgb
image/x-xbitmap=xbm
image/x-xpixmap=xpm
image/x-xwindowdump=xwd
image/png=png
message/rfc822=mht
text/css=css
text/h323=323
text/html=html
text/iuls=uls
text/plain=txt
text/richtext=rtx
text/scriptlet=sct
text/tab-separated-values=tsv
text/webviewhtml=htt
text/x-component=htc
text/x-setext=etx
text/x-vcard=vcf
video/mpeg=mpeg
video/quicktime=mov
video/x-la-asf=lsf
video/x-ms-asf=asf
video/x-msvideo=avi
video/x-sgi-movie=movie
x-world/x-vrml=xof
application/xhtml+xml=xhtml
application/vnd.openxmlformats-officedocument.wordprocessingml.template=dotx
application/vnd.openxmlformats-officedocument.wordprocessingml.document=docx
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet=xlsx
application/vnd.openxmlformats-officedocument.presentationml.presentation=pptx

你可能感兴趣的:(杂文)