httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantin Chuguev" <>
Subject AddOutputFilterByType is processed twice in proxied responses. Bug?
Date Wed, 18 Jun 2008 11:56:08 GMT

I use the AddOutputFilterByType directive to insert a few output  
filters into the filter chain for certain MIME types. After observing  
unexpected behaviour of the server I found out that these filters are  
added twice (via ap_set_content_type function):
- first inside the find_ct type_checker hook of the MIME module, based  
on the content of the TypesConfig file;
- then in the ap_proxy_http_process_response function, based on the  
Content-Type header returned by the back-end server.

Clearly the MIME hook should not try and guess about the content type  
of the proxied requests. Since it does it by parsing r->filename,  
perhaps it should also check if the latter starts with "proxy:" or if  
r->proxyreq is set?

There is a comment in mod_proxy.c mentioning type_checker and  
PROXY_MAGIC_TYPE but no corresponding code. I suspect the code did  
exist in past revisions. Apparently the idea was to use a special  
magic type for proxied requests and have this hook called before the  
MIME module one. Where has it gone?

For now as a workaround in proxied VirtualHosts I use "TypesConfig / 
dev/null". This is because Apache uses a hardcoded location of the  
file if the directive is missing completely, so I need to override it  
explicitly. This is far from perfect, especially if I need to process  
some of the paths of these VirtualHosts locally by the proxy.

Since there can be multiple different fixes of this bug and I'm not  
sure which is better, I haven't provided the patch.

Any ideas?

Konstantin Chuguev
Software Developer

Clickstream Technologies PLC, 58 Davies Street, London, W1K 5JF,  
Registered in England No. 3774129

  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message