Como definir regras mod_mime diferentes para o proxy reverso?

4

Por padrão, o httpd contém a seguinte configuração:

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types
    ...
</IfModule>

Este arquivo contém um mapeamento de extensões de nome de arquivo para tipos MIME. Normalmente, isso é o que eu quero, mas gostaria de desabilitar o mapeamento para proxies reversos. Como posso instruir o mime_module para processar /* , mas excluir /proxy/* ?

Por quê?

mime_module contém a seguinte linha:

application/x-msdownload            exe dll com bat msi

O aplicativo que está sendo intermediado por proxy aceita PUT /proxy/rest/[email protected] e retorna 200 OK sem definir Content-Type ou um corpo de resposta. De acordo com o link , isso é perfeitamente legal (já que há não é um corpo de resposta).

mime_module acha que o URL se aplica a um arquivo .com e aplica, por engano, Content-Type: application/x-msdownload . Como eu sei que /proxy/rest/ nunca retorna arquivos, gostaria de desabilitar mime_module para esse caminho.

    
por Gili 08.10.2013 / 22:59

2 respostas

5

Eu posso pensar em três maneiras de conseguir isso.

  1. Dentro de um diretório, virtualhost ou contexto .htaccess, você pode usar

    RemoveType .com

    para remover o mapeamento. Não tenho certeza se isso funcionará em um contexto de proxy, pois não é um diretório real. Mas se isso não acontecer, você pode seguir a rota oposta de remover .com da lista geral e adicioná-lo especificamente aos diretórios desejados.

  2. No entanto, na sua situação, pode ser mais útil dar uma olhada em mod_mime_magic . O que basicamente faz é que, em vez de ter um mapeamento de extensão para tipo, ele realmente observa o conteúdo do arquivo para ver o que realmente é.

    A desvantagem é que ele aumenta o processamento, portanto, seu desempenho sofrerá um pequeno impacto. Se você estiver perto dos seus limites, você vai querer fazer alguns testes de desempenho / teste de carga primeiro.

  3. Se todos os dados nesse diretório ou local sempre tiverem o mesmo tipo, você pode definir um ForceType para o diretório / local inteiro:

.

<Location /proxy>
   ForceType image/gif
</Location>
    
por 16.10.2013 / 15:30
1

Acabei fazendo o seguinte:

link

<Location /proxy>
    Include conf/remove_mime.conf
</Location>

remove_mime.conf:

# Removes configuration set by TypesConfig mime.types
RemoveType ez
RemoveType aw
RemoveType atom
RemoveType atomcat
RemoveType atomsvc
RemoveType ccxml
RemoveType cu
RemoveType davmount
RemoveType dssc
RemoveType xdssc
RemoveType ecma
RemoveType emma
RemoveType epub
RemoveType pfr
RemoveType stk
RemoveType ipfix
RemoveType jar
RemoveType ser
RemoveType class
RemoveType js
RemoveType json
RemoveType lostxml
RemoveType hqx
RemoveType cpt
RemoveType mrc
RemoveType ma nb mb
RemoveType mathml
RemoveType mbox
RemoveType mscml
RemoveType mp4s
RemoveType doc dot
RemoveType mxf
RemoveType bin dms lha lrf lzh so iso dmg dist distz pkg bpk dump elc deploy
RemoveType oda
RemoveType opf
RemoveType ogx
RemoveType onetoc onetoc2 onetmp onepkg
RemoveType xer
RemoveType pdf
RemoveType pgp
RemoveType asc sig
RemoveType prf
RemoveType p10
RemoveType p7m p7c
RemoveType p7s
RemoveType cer
RemoveType crl
RemoveType pkipath
RemoveType pki
RemoveType pls
RemoveType ai eps ps
RemoveType cww
RemoveType rdf
RemoveType rif
RemoveType rnc
RemoveType rl
RemoveType rld
RemoveType rs
RemoveType rsd
RemoveType rss
RemoveType rtf
RemoveType sbml
RemoveType scq
RemoveType scs
RemoveType spq
RemoveType spp
RemoveType sdp
RemoveType setpay
RemoveType setreg
RemoveType shf
RemoveType smi smil
RemoveType rq
RemoveType srx
RemoveType gram
RemoveType grxml
RemoveType ssml
RemoveType plb
RemoveType psb
RemoveType pvb
RemoveType tcap
RemoveType pwn
RemoveType aso
RemoveType imp
RemoveType acu
RemoveType atc acutc
RemoveType air
RemoveType xdp
RemoveType xfdf
RemoveType azf
RemoveType azs
RemoveType azw
RemoveType acc
RemoveType ami
RemoveType apk
RemoveType cii
RemoveType fti
RemoveType atx
RemoveType mpkg
RemoveType m3u8
RemoveType swi
RemoveType aep
RemoveType mpm
RemoveType bmi
RemoveType rep
RemoveType cdxml
RemoveType mmd
RemoveType cdy
RemoveType cla
RemoveType rp9
RemoveType c4g c4d c4f c4p c4u
RemoveType csp
RemoveType cdbcmsg
RemoveType cmc
RemoveType clkx
RemoveType clkk
RemoveType clkp
RemoveType clkt
RemoveType clkw
RemoveType wbs
RemoveType pml
RemoveType ppd
RemoveType car
RemoveType pcurl
RemoveType rdz
RemoveType fe_launch
RemoveType dna
RemoveType mlp
RemoveType dpg
RemoveType dfac
RemoveType geo
RemoveType mag
RemoveType nml
RemoveType esf
RemoveType msf
RemoveType qam
RemoveType slt
RemoveType ssf
RemoveType es3 et3
RemoveType ez2
RemoveType ez3
RemoveType fdf
RemoveType mseed
RemoveType seed dataless
RemoveType gph
RemoveType ftc
RemoveType fm frame maker book
RemoveType fnc
RemoveType ltf
RemoveType fsc
RemoveType oas
RemoveType oa2
RemoveType oa3
RemoveType fg5
RemoveType bh2
RemoveType ddd
RemoveType xdw
RemoveType xbd
RemoveType fzs
RemoveType txd
RemoveType ggb
RemoveType ggt
RemoveType gex gre
RemoveType gxt
RemoveType g2w
RemoveType g3w
RemoveType gmx
RemoveType kml
RemoveType kmz
RemoveType gqf gqs
RemoveType gac
RemoveType ghf
RemoveType gim
RemoveType grv
RemoveType gtm
RemoveType tpl
RemoveType vcg
RemoveType zmm
RemoveType hbci
RemoveType les
RemoveType hpgl
RemoveType hpid
RemoveType hps
RemoveType jlt
RemoveType pcl
RemoveType pclxl
RemoveType sfd-hdstx
RemoveType x3d
RemoveType mpy
RemoveType afp listafp list3820
RemoveType irm
RemoveType sc
RemoveType icc icm
RemoveType igl
RemoveType ivp
RemoveType ivu
RemoveType xpw xpx
RemoveType qbo
RemoveType qfx
RemoveType rcprofile
RemoveType irp
RemoveType xpr
RemoveType jam
RemoveType rms
RemoveType jisp
RemoveType joda
RemoveType ktz ktr
RemoveType karbon
RemoveType chrt
RemoveType kfo
RemoveType flw
RemoveType kon
RemoveType kpr kpt
RemoveType ksp
RemoveType kwd kwt
RemoveType htke
RemoveType kia
RemoveType kne knp
RemoveType skp skd skt skm
RemoveType sse
RemoveType lbd
RemoveType lbe
RemoveType 123
RemoveType apr
RemoveType pre
RemoveType nsf
RemoveType org
RemoveType scm
RemoveType lwp
RemoveType portpkg
RemoveType mcd
RemoveType mc1
RemoveType cdkey
RemoveType mwf
RemoveType mfm
RemoveType flo
RemoveType igx
RemoveType mif
RemoveType daf
RemoveType dis
RemoveType mbk
RemoveType mqy
RemoveType msl
RemoveType plc
RemoveType txf
RemoveType mpn
RemoveType mpc
RemoveType xul
RemoveType cil
RemoveType cab
RemoveType xls xlm xla xlc xlt xlw
RemoveType xlam
RemoveType xlsb
RemoveType xlsm
RemoveType xltm
RemoveType eot
RemoveType chm
RemoveType ims
RemoveType lrm
RemoveType cat
RemoveType stl
RemoveType ppt pps pot
RemoveType ppam
RemoveType pptm
RemoveType sldm
RemoveType ppsm
RemoveType potm
RemoveType mpp mpt
RemoveType docm
RemoveType dotm
RemoveType wps wks wcm wdb
RemoveType wpl
RemoveType xps
RemoveType mseq
RemoveType mus
RemoveType msty
RemoveType nlu
RemoveType nnd
RemoveType nns
RemoveType nnw
RemoveType ngdat
RemoveType n-gage
RemoveType rpst
RemoveType rpss
RemoveType edm
RemoveType edx
RemoveType ext
RemoveType odc
RemoveType otc
RemoveType odb
RemoveType odf
RemoveType odft
RemoveType odg
RemoveType otg
RemoveType odi
RemoveType oti
RemoveType odp
RemoveType otp
RemoveType ods
RemoveType ots
RemoveType odt
RemoveType otm
RemoveType ott
RemoveType oth
RemoveType xo
RemoveType dd2
RemoveType oxt
RemoveType pptx
RemoveType sldx
RemoveType ppsx
RemoveType potx
RemoveType xlsx
RemoveType xltx
RemoveType docx
RemoveType dotx
RemoveType dp
RemoveType pdb pqa oprc
RemoveType paw
RemoveType str
RemoveType ei6
RemoveType efif
RemoveType wg
RemoveType plf
RemoveType pbd
RemoveType box
RemoveType mgz
RemoveType qps
RemoveType ptid
RemoveType qxd qxt qwd qwt qxl qxb
RemoveType bed
RemoveType mxl
RemoveType musicxml
RemoveType cod
RemoveType rm
RemoveType link66
RemoveType st
RemoveType see
RemoveType sema
RemoveType semd
RemoveType semf
RemoveType ifm
RemoveType itp
RemoveType iif
RemoveType ipk
RemoveType twd twds
RemoveType mmf
RemoveType teacher
RemoveType sdkm sdkd
RemoveType dxp
RemoveType sfs
RemoveType sdc
RemoveType sda
RemoveType sdd
RemoveType smf
RemoveType sdw
RemoveType vor
RemoveType sgl
RemoveType sxc
RemoveType stc
RemoveType sxd
RemoveType std
RemoveType sxi
RemoveType sti
RemoveType sxm
RemoveType sxw
RemoveType sxg
RemoveType stw
RemoveType sus susp
RemoveType svd
RemoveType sis sisx
RemoveType xsm
RemoveType bdm
RemoveType xdm
RemoveType tao
RemoveType tmo
RemoveType tpt
RemoveType mxs
RemoveType tra
RemoveType ufd ufdl
RemoveType utz
RemoveType umj
RemoveType unityweb
RemoveType uoml
RemoveType vcx
RemoveType vsd vst vss vsw
RemoveType vis
RemoveType vsf
RemoveType wbxml
RemoveType wmlc
RemoveType wmlsc
RemoveType wtb
RemoveType nbp
RemoveType wpd
RemoveType wqd
RemoveType stf
RemoveType xar
RemoveType xfdl
RemoveType hvd
RemoveType hvs
RemoveType hvp
RemoveType osf
RemoveType osfpvg
RemoveType saf
RemoveType spf
RemoveType cmp
RemoveType zir zirz
RemoveType zaz
RemoveType vxml
RemoveType hlp
RemoveType wsdl
RemoveType wspolicy
RemoveType abw
RemoveType ace
RemoveType aab x32 u32 vox
RemoveType aam
RemoveType aas
RemoveType bcpio
RemoveType torrent
RemoveType bz
RemoveType bz2 boz
RemoveType vcd
RemoveType chat
RemoveType pgn
RemoveType cpio
RemoveType csh
RemoveType deb udeb
RemoveType dir dcr dxr cst cct cxt w3d fgd swa
RemoveType wad
RemoveType ncx
RemoveType dtb
RemoveType res
RemoveType dvi
RemoveType bdf
RemoveType gsf
RemoveType psf
RemoveType otf
RemoveType pcf
RemoveType snf
RemoveType ttf ttc
RemoveType pfa pfb pfm afm
RemoveType spl
RemoveType gnumeric
RemoveType gtar
RemoveType hdf
RemoveType jnlp
RemoveType latex
RemoveType prc mobi
RemoveType application
RemoveType wmd
RemoveType wmz
RemoveType xbap
RemoveType mdb
RemoveType obd
RemoveType crd
RemoveType clp
RemoveType exe dll com bat msi
RemoveType mvb m13 m14
RemoveType wmf
RemoveType mny
RemoveType pub
RemoveType scd
RemoveType trm
RemoveType wri
RemoveType nc cdf
RemoveType p12 pfx
RemoveType p7b spc
RemoveType p7r
RemoveType rar
RemoveType sh
RemoveType shar
RemoveType swf
RemoveType xap
RemoveType sit
RemoveType sitx
RemoveType sv4cpio
RemoveType sv4crc
RemoveType tar
RemoveType tcl
RemoveType tex
RemoveType tfm
RemoveType texinfo texi
RemoveType ustar
RemoveType src
RemoveType der crt
RemoveType fig
RemoveType xpi
RemoveType xenc
RemoveType xhtml xht
RemoveType xml xsl
RemoveType dtd
RemoveType xop
RemoveType xslt
RemoveType xspf
RemoveType mxml xhvml xvml xvm
RemoveType zip
RemoveType adp
RemoveType au snd
RemoveType mid midi kar rmi
RemoveType mp4a
RemoveType mpga mp2 mp2a mp3 m2a m3a
RemoveType oga ogg spx
RemoveType eol
RemoveType dra
RemoveType dts
RemoveType dtshd
RemoveType lvp
RemoveType pya
RemoveType ecelp4800
RemoveType ecelp7470
RemoveType ecelp9600
RemoveType aac
RemoveType aif aiff aifc
RemoveType m3u
RemoveType wax
RemoveType wma
RemoveType ram ra
RemoveType rmp
RemoveType wav
RemoveType cdx
RemoveType cif
RemoveType cmdf
RemoveType cml
RemoveType csml
RemoveType xyz
RemoveType bmp
RemoveType cgm
RemoveType g3
RemoveType gif
RemoveType ief
RemoveType jpeg jpg jpe
RemoveType png
RemoveType btif
RemoveType svg svgz
RemoveType tiff tif
RemoveType psd
RemoveType djvu djv
RemoveType dwg
RemoveType dxf
RemoveType fbs
RemoveType fpx
RemoveType fst
RemoveType mmr
RemoveType rlc
RemoveType mdi
RemoveType npx
RemoveType wbmp
RemoveType xif
RemoveType ras
RemoveType cmx
RemoveType fh fhc fh4 fh5 fh7
RemoveType ico
RemoveType pcx
RemoveType pic pct
RemoveType pnm
RemoveType pbm
RemoveType pgm
RemoveType ppm
RemoveType rgb
RemoveType xbm
RemoveType xpm
RemoveType xwd
RemoveType eml mime
RemoveType igs iges
RemoveType msh mesh silo
RemoveType dwf
RemoveType gdl
RemoveType gtw
RemoveType mts
RemoveType vtu
RemoveType wrl vrml
RemoveType ics ifb
RemoveType css
RemoveType csv
RemoveType html htm
RemoveType txt text conf def list log in
RemoveType dsc
RemoveType rtx
RemoveType sgml sgm
RemoveType tsv
RemoveType t tr roff man me ms
RemoveType uri uris urls
RemoveType curl
RemoveType dcurl
RemoveType scurl
RemoveType mcurl
RemoveType fly
RemoveType flx
RemoveType gv
RemoveType 3dml
RemoveType spot
RemoveType jad
RemoveType wml
RemoveType wmls
RemoveType s asm
RemoveType c cc cxx cpp h hh dic
RemoveType f for f77 f90
RemoveType p pas
RemoveType java
RemoveType etx
RemoveType uu
RemoveType vcs
RemoveType vcf
RemoveType 3gp
RemoveType 3g2
RemoveType h261
RemoveType h263
RemoveType h264
RemoveType jpgv
RemoveType jpm jpgm
RemoveType mj2 mjp2
RemoveType mp4 mp4v mpg4
RemoveType mpeg mpg mpe m1v m2v
RemoveType ogv
RemoveType qt mov
RemoveType fvt
RemoveType mxu m4u
RemoveType pyv
RemoveType viv
RemoveType f4v
RemoveType fli
RemoveType flv
RemoveType m4v
RemoveType asf asx
RemoveType wm
RemoveType wmv
RemoveType wmx
RemoveType wvx
RemoveType avi
RemoveType movie
RemoveType ice

Nada bom, mas é o melhor que consegui encontrar.

    
por 17.10.2013 / 20:32