Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So I have a pretty standard Apache 2 setup, with AllowOverride all.

And I have three files in the "testing" folder under my docroot:

.htaccess

AddHandler send-as-is .asis

page.html

this is the page!

wtf.asis

Status: 301 Copy Is Elsewhere
Location: /testing/page.html
Content-Type: text/plain

Redirecting...

When I point my browser at /testing/wtf.asis, I see the text "this is the page!", but the address bar still says /testing/wtf.asis. I expected to see /testing/page.html in the address bar instead and to get a 301 redirect! Instead, I get a 200 response. What's going on? Is it doing an internal redirect? If so, why?

share|improve this question
    
Found the answer (below), but does anyone know any more details as to why this happens? –  laughingbovine Feb 10 '12 at 16:59
    
I had a vague idea that Location needs a full URL. Looking through the Apache2 source at $TOP/modules/generators/mod_asis.c I see no comment there as to why this behaviour. –  Luis Bruno Feb 10 '12 at 23:29

1 Answer 1

up vote 2 down vote accepted

I'm not sure, but I suspect that Location needs a full URL. Can you try that?

share|improve this answer
1  
This works. Sigh, Apache, why do you do this? –  laughingbovine Feb 10 '12 at 16:57
    
I looked a little but further, and it seems there is some CGI specification that tells web servers to make redirects without domain names internal. Sounds nifty, but relying on it is another matter. –  laughingbovine Mar 9 '12 at 17:04
    
You inspired me to look at the RFC; section 6.2.2 of ietf.org/rfc/rfc3875 says your server will do an internal subrequest if you return a bare "Location: /full-path-without-http-host" without other headers. Graham Dumpleton (author of mod_wsgi) says Apache will also accept an Status: 200 header. Perhaps you can try to return a Content-Type (for example) and see if the redirect is still handled as an internal subrequest? –  Luis Bruno Mar 12 '12 at 9:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.