You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Thomas Campbell <ap...@evasive.com> on 2005/01/16 12:33:22 UTC
[users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
Hi all,
It appears that ForceType isn't working properly for httpd-2.0.52-3.1 but I wanted to confirm before submitting a bug.
Here's the relevant information from my httpd.conf file:
<VirtualHost 192.168.0.24:80>
ServerAdmin test-mysystem@evasive.com
ServerName test-mysystem.evasive.com
DocumentRoot /ns02/webs/httpd.test-mysystem.evasive.com/htdocs
<Directory />
IndexOptions FancyIndexing VersionSort FoldersFirst HTMLTable IconsAreLinks
Options Includes Indexes FollowSymLinks
AllowOverride None
order allow,deny
allow from all
</Directory>
<Directory /ns02/webs/httpd.test-mysystem.evasive.com/htdocs/test2 >
ForceType application/msword
</Directory>
</VirtualHost>
And /etc/mime.types:
application/x-sh sh
If the file I attempt to retrieve is a file with the extension of ".sh" from the directory
/ns02/webs/httpd.test-mysystem.evasive.com/htdocs/test2 then it comes back as "Unknown File Type" which I believe means it is
picking up the "application/x-sh" from /etc/mime.types If I put any other type of file extension in that directory (that doesn't
have a setting in /etc/mime.types) then it works properly (tries to load it as a word document)
To answer your question (before you ask), I'm testing with "application/msword", I actually want to force "text/plain".
Any ideas? I think it's a bug as according to documentation on ForceType: "Note that unlike DefaultType, this directive overrides
all mime-type associations, including filename extensions, that might identify the media type."
Thanks
Thomas
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.12 - Release Date: 1/14/2005
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
Posted by Joshua Slive <js...@gmail.com>.
On Mon, 17 Jan 2005 17:47:38 -0800, Thomas Campbell <ap...@evasive.com> wrote:
> I'm confused about Directory. I thought that Directory used DocumentRoot because of information here:
>
> http://httpd.apache.org/docs-2.0/mod/core.html#directory
>
> there is an example at the bottom of that section that looks like the following:
>
> <Directory />
> Order Deny,Allow
> Deny from All
> </Directory>
>
> Which leads me to believe that Directory is DocumentRoot based (else why use /??)
Because Aliases (and other things) can cause requests to be served
from outside the DocumentRoot. Therefore it is often wise to protect
the entire filesystem by default.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: [users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
Posted by Thomas Campbell <ap...@evasive.com>.
Well, that fixed my problem. I think between the combination of a late night, my not knowing how to find out the "Content Type" via
the command line and fighting with IE cache, I just couldn't get this to work properly.
I say that because I just made that change to Directory this morning so last night I know I was using Directory "properly".
I'm confused about Directory. I thought that Directory used DocumentRoot because of information here:
http://httpd.apache.org/docs-2.0/mod/core.html#directory
there is an example at the bottom of that section that looks like the following:
<Directory />
Order Deny,Allow
Deny from All
</Directory>
Which leads me to believe that Directory is DocumentRoot based (else why use /??)
Anyway, thank you very much for the assistance!
Thomas
> -----Original Message-----
> From: Joshua Slive [mailto:jslive@gmail.com]
> Sent: Monday, January 17, 2005 5:17 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
>
> On Mon, 17 Jan 2005 14:01:40 -0800, Thomas Campbell <ap...@evasive.com> wrote:
> > <Directory /test>
> > ForceType text/plain
> > </Directory>
>
> <Directory> is relative to the filesystem root, not the DocumentRoot.
> You need to tack on your DocumentRoot directory to the front of /test
> if you want that to work.
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 1/16/2005
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 1/16/2005
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
Posted by Joshua Slive <js...@gmail.com>.
On Mon, 17 Jan 2005 14:01:40 -0800, Thomas Campbell <ap...@evasive.com> wrote:
> <Directory /test>
> ForceType text/plain
> </Directory>
<Directory> is relative to the filesystem root, not the DocumentRoot.
You need to tack on your DocumentRoot directory to the front of /test
if you want that to work.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
Posted by Leif W <wa...@usa.net>.
> Dick Davies; 2005 January 17 Monday 06:45
>* Thomas Campbell <ap...@evasive.com> [0113 00:13]:
>> Ok, gotta ask the question I was avoiding.. how do I do that?
>
> A simple way is just
>
> telnet server 80
> GET /path/to/a/file/in/that/dir HTTP/1.0
> <enter again>
>
> and read the 'content-type' apache sends.
You can simplify this by using HEAD instead of GET, to get just the
headers, and not the content, which might otherwise make headers scroll
off the screen or dump binary and beep and corrupt the terminal and suck
bandwidth.
If using a Name Based Virtual Host (as opposed to IP Based Virtual
Host), then you need to send the Host header and specify HTTP/1.1 .
Note that case is sensitive for Host (not HOST or hOsT).
==== begin input ====
telnet server 80
HEAD /path/to/file HTTP/1.1
Host: server
==== end input ====
It may be handy to write a shell script or bat file (or some other
windows scripting technique) to extract the server name (stuff after ://
and before the next /) and send the Host header and HTTP/1.1 HEAD
request.
Leif
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: [users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
Posted by Thomas Campbell <ap...@evasive.com>.
Cool!
Ok, had to make some changes though because the server below is a virtual host:
I have this line in /etc/mime.types
application/x-sh sh
and I have this as my primary virtual host configuration (before anything)
<VirtualHost 192.168.0.24:80>
ServerAdmin apache@evasive.com
ServerName www.evasive.com
DocumentRoot /ns02/webs/httpd.www.evasive.com/htdocs
<Directory />
Options Includes Indexes FollowSymLinks
IndexOptions FancyIndexing VersionSort FoldersFirst HTMLTable IconsAreLinks
AllowOverride None
order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /ns02/webs/httpd.www.evasive.com/cgi-bin/
</VirtualHost>
Running the telnet test:
-----------------------------
# telnet www.evasive.com 80
Trying 192.168.0.24...
Connected to www.evasive.com (192.168.0.24).
Escape character is '^]'.
GET /test/1.sh HTTP/1.0
HTTP/1.1 200 OK
Date: Mon, 17 Jan 2005 21:53:34 GMT
Server: Apache/2.0.52
Last-Modified: Mon, 17 Jan 2005 21:53:07 GMT
ETag: "2a0004-f-68d236c0"
Accept-Ranges: bytes
Content-Length: 15
Connection: close
Content-Type: application/x-sh
This
si
a test
Connection closed by foreign host.
#
--------------------------------
So, I added the following lines before the </VirtualHost> line:
<Directory /test>
ForceType text/plain
</Directory>
And got this:
---------------------------------
# r telnet
telnet www.evasive.com 80
Trying 192.168.0.24...
Connected to www.evasive.com (192.168.0.24).
Escape character is '^]'.
GET /test/1.sh HTTP/1.0
HTTP/1.1 200 OK
Date: Mon, 17 Jan 2005 21:55:25 GMT
Server: Apache/2.0.52
Last-Modified: Mon, 17 Jan 2005 21:53:07 GMT
ETag: "2a0004-f-68d236c0"
Accept-Ranges: bytes
Content-Length: 15
Connection: close
Content-Type: application/x-sh
This
si
a test
Connection closed by foreign host.
#
shouldn't it have returned something more like this? (I commented the line out of /etc/mime.types so it would pick up the
DefaultType which is also text/plain):
----------------------------------
# telnet www.evasive.com 80
Trying 192.168.0.24...
Connected to www.evasive.com (192.168.0.24).
Escape character is '^]'.
GET /test/1.sh HTTP/1.0
HTTP/1.1 200 OK
Date: Mon, 17 Jan 2005 21:57:51 GMT
Server: Apache/2.0.52
Last-Modified: Mon, 17 Jan 2005 21:53:07 GMT
ETag: "2a0004-f-68d236c0"
Accept-Ranges: bytes
Content-Length: 15
Connection: close
Content-Type: text/plain; charset=UTF-8
This
si
a test
Connection closed by foreign host.
#
-----------------------------------
Thank you very much for the help!
Thomas
> -----Original Message-----
> From: Dick Davies [mailto:rasputin@hellooperator.net] On Behalf Of Dick Davies
> Sent: Monday, January 17, 2005 3:45 AM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
>
> * Thomas Campbell <ap...@evasive.com> [0113 00:13]:
> > Ok, gotta ask the question I was avoiding.. how do I do that?
>
> A simple way is just
>
> telnet server 80
> GET /path/to/a/file/in/that/dir HTTP/1.0
> <enter again>
>
> and read the 'content-type' apache sends.
>
> > > -----Original Message-----
> > > From: Dick Davies [mailto:rasputin@hellooperator.net] On Behalf Of Dick Davies
> > > Sent: Sunday, January 16, 2005 6:10 AM
> > > To: users@httpd.apache.org
> > > Subject: Re: [users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
> > >
> > > * Thomas Campbell <ap...@evasive.com> [0133 11:33]:
> > > > Hi all,
> > > >
> > > > It appears that ForceType isn't working properly for httpd-2.0.52-3.1 but I wanted to confirm
> > > before submitting a bug.
> > > >
> > > > <Directory /ns02/webs/httpd.test-mysystem.evasive.com/htdocs/test2 >
> > > > ForceType application/msword
> > > > </Directory>
> > > > </VirtualHost>
> > > >
> > > > And /etc/mime.types:
> > > >
> > > > application/x-sh sh
> > > >
> > > > If the file I attempt to retrieve is a file with the extension of ".sh" from the directory
> > > > /ns02/webs/httpd.test-mysystem.evasive.com/htdocs/test2 then it comes back as "Unknown File
> Type"
> > > which I believe means it is
> > > > picking up the "application/x-sh" from /etc/mime.types
>
> --
> 'common sense is what tells you that the world is flat.'
> -- Principia Discordia
> Rasputin :: Jack of All Trades - Master of Nuns
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 1/16/2005
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 1/16/2005
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
Posted by Dick Davies <ra...@hellooperator.net>.
* Thomas Campbell <ap...@evasive.com> [0113 00:13]:
> Ok, gotta ask the question I was avoiding.. how do I do that?
A simple way is just
telnet server 80
GET /path/to/a/file/in/that/dir HTTP/1.0
<enter again>
and read the 'content-type' apache sends.
> > -----Original Message-----
> > From: Dick Davies [mailto:rasputin@hellooperator.net] On Behalf Of Dick Davies
> > Sent: Sunday, January 16, 2005 6:10 AM
> > To: users@httpd.apache.org
> > Subject: Re: [users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
> >
> > * Thomas Campbell <ap...@evasive.com> [0133 11:33]:
> > > Hi all,
> > >
> > > It appears that ForceType isn't working properly for httpd-2.0.52-3.1 but I wanted to confirm
> > before submitting a bug.
> > >
> > > <Directory /ns02/webs/httpd.test-mysystem.evasive.com/htdocs/test2 >
> > > ForceType application/msword
> > > </Directory>
> > > </VirtualHost>
> > >
> > > And /etc/mime.types:
> > >
> > > application/x-sh sh
> > >
> > > If the file I attempt to retrieve is a file with the extension of ".sh" from the directory
> > > /ns02/webs/httpd.test-mysystem.evasive.com/htdocs/test2 then it comes back as "Unknown File Type"
> > which I believe means it is
> > > picking up the "application/x-sh" from /etc/mime.types
--
'common sense is what tells you that the world is flat.'
-- Principia Discordia
Rasputin :: Jack of All Trades - Master of Nuns
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: [users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
Posted by Thomas Campbell <ap...@evasive.com>.
Ok, gotta ask the question I was avoiding.. how do I do that?
Thomas
> -----Original Message-----
> From: Dick Davies [mailto:rasputin@hellooperator.net] On Behalf Of Dick Davies
> Sent: Sunday, January 16, 2005 6:10 AM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
>
> * Thomas Campbell <ap...@evasive.com> [0133 11:33]:
> > Hi all,
> >
> > It appears that ForceType isn't working properly for httpd-2.0.52-3.1 but I wanted to confirm
> before submitting a bug.
> >
> > Here's the relevant information from my httpd.conf file:
> >
> > <VirtualHost 192.168.0.24:80>
> > ServerAdmin test-mysystem@evasive.com
> > ServerName test-mysystem.evasive.com
> >
> > DocumentRoot /ns02/webs/httpd.test-mysystem.evasive.com/htdocs
> >
> > <Directory />
> > IndexOptions FancyIndexing VersionSort FoldersFirst HTMLTable IconsAreLinks
> > Options Includes Indexes FollowSymLinks
> > AllowOverride None
> > order allow,deny
> > allow from all
> >
> > </Directory>
> >
> > <Directory /ns02/webs/httpd.test-mysystem.evasive.com/htdocs/test2 >
> > ForceType application/msword
> > </Directory>
> > </VirtualHost>
> >
> > And /etc/mime.types:
> >
> > application/x-sh sh
> >
> > If the file I attempt to retrieve is a file with the extension of ".sh" from the directory
> > /ns02/webs/httpd.test-mysystem.evasive.com/htdocs/test2 then it comes back as "Unknown File Type"
> which I believe means it is
> > picking up the "application/x-sh" from /etc/mime.types If I put any other type of file extension
> in that directory (that doesn't
> > have a setting in /etc/mime.types) then it works properly (tries to load it as a word document)
>
> Check what mime-type apache is sending - I know some IE versions do stupid things with mime
> negotiation based
> on extension.
>
> --
> 'Some people, when confronted with a problem, think I know, I'll use
> regular expressions. Now they have two problems.'
> -- Jamie Zawinski
> Rasputin :: Jack of All Trades - Master of Nuns
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.6.12 - Release Date: 1/14/2005
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 1/16/2005
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] ForceType not working properpy for httpd-2.0.52-3.1
Posted by Dick Davies <ra...@hellooperator.net>.
* Thomas Campbell <ap...@evasive.com> [0133 11:33]:
> Hi all,
>
> It appears that ForceType isn't working properly for httpd-2.0.52-3.1 but I wanted to confirm before submitting a bug.
>
> Here's the relevant information from my httpd.conf file:
>
> <VirtualHost 192.168.0.24:80>
> ServerAdmin test-mysystem@evasive.com
> ServerName test-mysystem.evasive.com
>
> DocumentRoot /ns02/webs/httpd.test-mysystem.evasive.com/htdocs
>
> <Directory />
> IndexOptions FancyIndexing VersionSort FoldersFirst HTMLTable IconsAreLinks
> Options Includes Indexes FollowSymLinks
> AllowOverride None
> order allow,deny
> allow from all
>
> </Directory>
>
> <Directory /ns02/webs/httpd.test-mysystem.evasive.com/htdocs/test2 >
> ForceType application/msword
> </Directory>
> </VirtualHost>
>
> And /etc/mime.types:
>
> application/x-sh sh
>
> If the file I attempt to retrieve is a file with the extension of ".sh" from the directory
> /ns02/webs/httpd.test-mysystem.evasive.com/htdocs/test2 then it comes back as "Unknown File Type" which I believe means it is
> picking up the "application/x-sh" from /etc/mime.types If I put any other type of file extension in that directory (that doesn't
> have a setting in /etc/mime.types) then it works properly (tries to load it as a word document)
Check what mime-type apache is sending - I know some IE versions do stupid things with mime negotiation based
on extension.
--
'Some people, when confronted with a problem, think I know, I'll use
regular expressions. Now they have two problems.'
-- Jamie Zawinski
Rasputin :: Jack of All Trades - Master of Nuns
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org