Apache: mod_rewrite with HTTP_HOST etc.

Apache: mod_rewrite with HTTP_HOST etc.

Post by Keith D. Tyl » Thu, 11 Sep 1997 04:00:00



The docs for mod_rewrite say that "for http/1.0 there is no solution, but
for http/1.1 requests using HTTP Host: headers, you can do..."

What I need to know is, is the ability of things like mod_rewrite rules to
use HTTP headers dependent on the request type the browser claims, or is
it basen on whether the header actually exists?

In other words, Netscape 3.0 sends:

GET / HTTP/1.0
Connection: Keep-Alive
User-Agent: Mozilla/3.01 (X11; I; HP-UX B.10.10 9000/821)
Host: northshore.shore.net:3137
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

Now the connection type is announced as HTTP/1.0, but it still sends a
Host: header. Can I use this Host: header information in mod_rewrite
rules, even though the request was sent claiming to be HTTP/1.0 and not
1.1? It would be a big help in my RewriteRule efforts.

Thanks,
Kdt

 
 
 

Apache: mod_rewrite with HTTP_HOST etc.

Post by Marc Slemk » Thu, 11 Sep 1997 04:00:00


Well, it is trivial enough for you to try it and would take 5 seconds.

Yes, you can use it even if the request was a HTTP/1.0 request.  The
docs have slightly incorrect wording if they say what you quote
below; more accurate would be "there is no general solution, but
for clients sending the HTTP/1.1 Host: header you can do...".


Quote:>The docs for mod_rewrite say that "for http/1.0 there is no solution, but
>for http/1.1 requests using HTTP Host: headers, you can do..."
>What I need to know is, is the ability of things like mod_rewrite rules to
>use HTTP headers dependent on the request type the browser claims, or is
>it basen on whether the header actually exists?
>In other words, Netscape 3.0 sends:
>GET / HTTP/1.0
>Connection: Keep-Alive
>User-Agent: Mozilla/3.01 (X11; I; HP-UX B.10.10 9000/821)
>Host: northshore.shore.net:3137
>Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
>Now the connection type is announced as HTTP/1.0, but it still sends a
>Host: header. Can I use this Host: header information in mod_rewrite
>rules, even though the request was sent claiming to be HTTP/1.0 and not
>1.1? It would be a big help in my RewriteRule efforts.
>Thanks,
>Kdt


 
 
 

Apache: mod_rewrite with HTTP_HOST etc.

Post by Keith D. Tyl » Fri, 12 Sep 1997 04:00:00


: Well, it is trivial enough for you to try it and would take 5 seconds.
: Yes, you can use it even if the request was a HTTP/1.0 request.  The

Thanks. I've been trying, but wanted to know if the problems I was having
were related to this or not. Now I know it's something I'm doing wrong.

Kdt

 
 
 

1. Serving with the enemy.... (Apache, Proxy, mod_rewrite etc)

Evening,

Anyone seen a way to proxy by a ** file type ** on an Apache box?

At the moment mod_proxy will allow me ProxyPass which allows
me to setup a web directory on my linux box which transparently
accesses another machine

eg: /virtual/file.asp -> http://internal.ip/stuff/virtual/file.asp

And looking through mod_rewrite I can rewrite requests for a file
from http://www.bob.com/virtual/file.asp -> http://wherever/file.asp

HOWEVER....

What I would ideally like is an "elegant solution" (worst case, some
sort of hack around mod_proxy?) that looks at the filetype I am
requesting, and if it has the extension .asp then proxy through to an
internal machine. This way, I can run .asp files (ick phooey) along with
.php and the rest :o)

[for the curious, I have already considered proxying through everything
and letting the internal machine do the web serving - however this brings
about a whole bunch of compromises in things I need to do on the linux box
accesible through the web....]

Any suggestions (preferbly in the form of "if you type this in your config
files it will work), or code snippets (eg a hack to mod_proxy) please email
me at:


Cheers :o)

John G Doe

2. Linux-Setup Digest #417

3. Apache 1.3.4 - mod_rewrite issue - Apache 1.3.4

4. SCO OSR505 as a router does not work

5. Rewriting HTTP_HOST

6. Sparc10 Audio...

7. HTTP_HOST and log files

8. [via-rhine][PATCH] fix races

9. Proxy and HTTP_HOST header

10. Apache: mod_rewrite

11. Apache mod_rewrite URI->URI remapping?

12. apache/redhat/mod_rewrite bugfix

13. Apache, mod_rewrite and suEXEC