简体   繁体   中英

What is performing Transparent Content Negotiation in Apache

I inherited a fairly complex Java web application that exhibits a mysterious behaviour and I need to know what causes it.

The application requests a file file.css . If file.css exists it is returned. If file.css does not exist, but file.css.gz does exist, the gzipped file is returned, with the following unusual headers:

Content-Location: file.css.gz
Content-Type: application/x-gzip
TCN: choice
Vary: negotiate

The presence of the TCN header means that a request was transparently negotiated, most likely by an Apache RewriteRule, but I can't find where the rule is defined. I've located and searched every Apache config file on the server (multiple files are referenced with Include ) and commented-out every mention of "gzip" or ".gz". Across all config files there is only a single RewriteRule and it's for SSL. After restarting Apache I still can't disable the behaviour.

Is this the default behaviour of Apache, or does this look like the behaviour of a certain module?

The server's OS is RHEL 5.8, Apache is 2.2.

The culprit was Apache MultiViews . This was a frustrating investigation because configuring MultiViews involves no mention of RewriteRule or any of the file extensions it will automatically substitute. You have to already know about MultiViews before you can understand that it is causing this behaviour.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM