apache - mod_proxy_ajp error: renders html as text/plain, prompts user to "save as..." -


we have odd, intermittent error occurs mod_proxy_ajp, i.e. using apache front end tomcat server.

the error

  • user clicks on link browser prompts user "save as...." (e.g. in firefox "you have chosen top open thread.jsp application/octet-stream"...what should firefox file)
  • user says "huh?" , presses "cancel"
  • user clicks again on same link
  • browser displays page correctly

this error occurs intermittently, unfortunately on our test server , on production.

in firefox's livehttpheaders see following in above usecase:

  • first page download (i.e. click on link) "text/plain"
  • second download "text/html"

i thought problem may stem proxypassreverse (i.e. muddling whether use http or ajp), these proxypassreverse settings resulted in same error:

additionally, i've checked apache error logs (set debug) , see no warnings or errors...

** works mod_proxy_http ?? **

it appears switching mod_proxy_http 'solves' problem. limited testing, have not been able recreate problem in test environment.

because problem intermittent, i'm not 100% sure mod_proxy_http "solves" problem

environment

  • apache 2.2 windows
  • jboss 4.2.2 end (tomcat 6)

one other data point

for better or worse, servlet filter in tomcat gzips html before sending apache. (which means work apache must unzip before performs proxypassreverse's "find , replace"). don't know if "gzip" messes up.

questions

  • anyone seen before?
  • what tools analyze cause?

thanks

addendum 1: here livehttpheaders output

browser incorrectly sees html "text/plain"

http://forums.customer.com/pe/action/forums/displaythread?rootpostid=10842016&channelid=1&portalpageid=1002  http://forums.customer.com/pe/action/forums/displaythread?rootpostid=10842016&channelid=1&portalpageid=1002 http/1.1 host: forums.customer.com user-agent: mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9.2.13) gecko/20101203 firefox/3.6.13 ( .net clr 3.5.30729) accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: en-us,en;q=0.5 accept-encoding: gzip,deflate accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7 keep-alive: 115 proxy-connection: keep-alive cookie: __utma=156962862.829309431.1260304144.1297956514.1297958674.234; __utmz=156962862.1296760237.232.50.utmcsr=forumstest.customer.com|utmccn=(referral)|utmcmd=referral|utmcct=/pe/action/forums/displaythread; s_vi=[cs]v1|258f5b88051d3fc3-40000105c056085f[ce]; inqvital=xd|0^sesmgr|{"sid":4,"lsts":1292598007}^incmgr|{"id":"755563420055418864","group":"chat","ltt":1292598006741,"sid":"755563549194447187","igds":"1290627502757","exempt":false}^inq|{"customerid":"755562378269271622"}^salemgr|{"state":"unsold","qdat":{},"sdat":{}}; inqstate=slnd|1^lnd|{"c":4,"flt":1274728016,"lldt":17869990,"pgs":{"201198":{"c":1,"flt":1274728016,"lldt":0},"0":{"c":3,"flt":1274845009,"lldt":17752997}},"pq":["0","0","0","201198"],"fsld":1274728016697}; adv_search_results_page=10; ep_beta=1; visitorid=57307059; jsessionid=6jxlndhrdjr9th3b5gvtvkw1dzln1zvhvklr2r4gtljylhjgjy3q!683274050; __utmc=156962862; jsessionid=6jxlndhrdjr9th3b5gvtvkw1dzln1zvhvklr2r4gtljylhjgjy3q!683274050; tlthid=5cca50304de99e28db79a7b3267d4231; tltsid=9dfcde8045b374aab752cc98a30e8311; arecookiesenabled=1; s_cc=true; sc_links=%5b%5bb%5d%5d; s_sq=%5b%5bb%5d%5d; __utmb=156962862.64.10.1297958674; memberexists=t; ev1=greywolf%20hdtv%20whmx cache-control: max-age=0  http/1.0 200 ok date: thu, 17 feb 2011 17:38:42 gmt content-type: text/plain x-cache: miss samus.company.com x-cache-lookup: miss samus.company.com:3128 via: 1.0 samus.company.com:3128 (squid/2.6.stable20) proxy-connection: close ---------------------------------------------------------- 

browser correctly sees html "text/html"

http://forums.customer.com/pe/action/forums/displaythread?rootpostid=10842016&channelid=1&portalpageid=1002  http://forums.customer.com/pe/action/forums/displaythread?rootpostid=10842016&channelid=1&portalpageid=1002 http/1.1 host: forums.customer.com user-agent: mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9.2.13) gecko/20101203 firefox/3.6.13 ( .net clr 3.5.30729) accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: en-us,en;q=0.5 accept-encoding: gzip,deflate accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7 keep-alive: 115 proxy-connection: keep-alive cookie: __utma=156962862.829309431.1260304144.1297956514.1297958674.234; __utmz=156962862.1296760237.232.50.utmcsr=forumstest.customer.com|utmccn=(referral)|utmcmd=referral|utmcct=/pe/action/forums/displaythread; s_vi=[cs]v1|258f5b88051d3fc3-40000105c056085f[ce]; inqvital=xd|0^sesmgr|{"sid":4,"lsts":1292598007}^incmgr|{"id":"755563420055418864","group":"chat","ltt":1292598006741,"sid":"755563549194447187","igds":"1290627502757","exempt":false}^inq|{"customerid":"755562378269271622"}^salemgr|{"state":"unsold","qdat":{},"sdat":{}}; inqstate=slnd|1^lnd|{"c":4,"flt":1274728016,"lldt":17869990,"pgs":{"201198":{"c":1,"flt":1274728016,"lldt":0},"0":{"c":3,"flt":1274845009,"lldt":17752997}},"pq":["0","0","0","201198"],"fsld":1274728016697}; adv_search_results_page=10; ep_beta=1; visitorid=57307059; jsessionid=6jxlndhrdjr9th3b5gvtvkw1dzln1zvhvklr2r4gtljylhjgjy3q!683274050; __utmc=156962862; jsessionid=6jxlndhrdjr9th3b5gvtvkw1dzln1zvhvklr2r4gtljylhjgjy3q!683274050; tlthid=5cca50304de99e28db79a7b3267d4231; tltsid=9dfcde8045b374aab752cc98a30e8311; arecookiesenabled=1; s_cc=true; sc_links=%5b%5bb%5d%5d; s_sq=%5b%5bb%5d%5d; __utmb=156962862.64.10.1297958674; memberexists=t; ev1=greywolf%20hdtv%20whmx cache-control: max-age=0  http/1.0 200 ok date: thu, 17 feb 2011 17:38:44 gmt x-powered-by: servlet 2.4; jboss-4.2.1.ga (build: svntag=jboss_4_2_1_ga date=200707131605)/tomcat-5.5 content-encoding: gzip content-type: text/html;charset=utf-8 content-length: 24739 x-cache: miss samus.company.com x-cache-lookup: miss samus.company.com:3128 via: 1.0 samus.company.com:3128 (squid/2.6.stable20) proxy-connection: keep-alive ---------------------------------------------------------- 

addendum 2: additional information

the browser did receive "gzipped" file. had earlier clicked "save as..." when few of these errors occurred. gunzip processed files , converted them html.

answer here: how preserve content-type header of tomcat http response sent through ajp connector apache using mod_proxy

set defaulttype none in apache configuration.

# defaulttype: default mime type server use document # if cannot otherwise determine one, such filename extensions. # if server contains text or html documents, "text/plain" # value.  if of content binary, such applications # or images, may want use "application/octet-stream" instead # keep browsers trying display binary files though # text. # defaulttype none 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -