Thank you for answering, Christophe. Appreciated. The ErrorDocument directive changes the *body* of an error message. This is not what I want. I want to change what is known in the HTTP protocol as "reason phrase". I'm not sure your Perl test is testing the right thing, but I have to admit that my Perl skills are rusty. Let me show a Curl test: My .asis file looks like this: --- file begin Status: 401 Blablabla<CR><LF> Content-type: text/plain<CR><LF> <CR><LF> How are you doing?<LF> Okay, I hope.<CR><LF> --- file end (I've played around with line endings. I've tried to make the file fully HTTP compliant, thinking that would help, meaning I only use a single <LF> within the body, while I use <CR><LF> everywhere else. The Handler is called 'as-is' so my expectation is that such file will be sent as-is on the wire. In any case, it doesn't seem ti make a difference) And then a curl test: curl --verbose http://mytest.lbruun.net/ --- curl output begin * About to connect() to mytest.lbruun.net port 80 (#0) * Trying 207.180.233.34... * Connected to mytest.lbruun.net (207.180.233.34) port 80 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.29.0 > Host: mytest.lbruun.net > Accept: */* > < HTTP/1.1 200 OK < Date: Fri, 05 Mar 2021 17:38:08 GMT < Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips < Last-Modified: Fri, 05 Mar 2021 17:38:04 GMT < ETag: "99-5bccd8bdbc707" < Accept-Ranges: bytes < Content-Length: 153 < Content-Type: text/html; charset=UTF-8 < Status: 401 Blablabla Content-type: text/plain How are you doing? Ok, I hope. * Connection #0 to host mytest.lbruun.net left intact --- curl output end As you can see it clearly picks up my .asis file. So misspelled handler name is certainly not the problem. However, as you can see the status code is still 200. In my example I expected it to be 401. To be more precise I would expect curl output line which currently reads... < HTTP/1.1 200 OK instead to be < HTTP/1.1 401 Blablabla I hope it is now a bit clearer. I think perhaps the misunderstanding is that I expect the "Status" header to override the real HTTP status when the server sends its output, rather than leaving such override for the HTTP client to interpret. Thanks /Lars On Thu, Mar 4, 2021 at 9:24 PM Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> wrote: > > > > Le 04/03/2021 à 21:15, Christophe JAILLET a écrit : > > Le 04/03/2021 à 08:20, Lars Bruun-Hansen a écrit : > >> How do I customize the HTTP Reason Phrase ? > >> > >> Definition: The Reason Phrase is sent in an HTTP response on the very > >> first line immediately following the status code, for example such > >> line may look like this: > >> > >> HTTP/1.1 401 Unauthorized > >> > >> In this case "Unauthorized" is the Reason Phrase. > >> > >> I've tried the Send-as-is Handler [1] which according to its > >> documentation should be able to do this. For example, I have an .asis > >> file which looks like this: > >> > >> ----file content begin > >> Status: 401 Blablabla > >> Content-type: text/html > >> > >> <html> > >> <head> > >> <title>Foo Bar Title</title> > >> </head> > >> <body> > >> <h1>You can't do that</h1> > >> </body> > >> </html> > >> ----file content end > >> > >> This .asis file gets picked up and used in the response but it doesn't > >> really change the status code. I've looked into the source code for > >> the as-is module and can see no evidence that the documentation is > >> correct in stating that the header named "Status" will actually be > >> used for anything. As long as the .asis file can be successfully read > >> then the status code will be 200. That doesn't match the > >> documentation. > >> > >> In any case maybe there's another way to customize Reason Phrase? > >> > >> Thanks. > >> > >> /Lars > >> > >> [1] https://httpd.apache.org/docs/2.4/mod/mod_asis.html > >> > > > > Hi, > > I've tested it with the test framework and it works as expected. > > (See [1] for the test written in perl, and [2] for the .asis files where > > the 403 and 404 response codes come from) > > > > I've slightly modified the test code ([1]) and I confirm that the status > > phrase is also left unmodified, as expected. > > > > > > In fact, the response code comes "as-is" from the file itself. It is > > included in the processing flow of Apache by the > > 'apr_brigade_insert_file()' at line 95. > > So you can't find any kind of special "status" handling in the code, as > > there is no manipulation done on the file content itself. > > > > > > Just in case, the handler name is "send-as-is" (no uppercase S as the > > first letter as written is your mail). See line 37 of the module source > > code. > > > > CJ > > > > > > > > [1]: > > http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/asis.t?revision=647766&view=markup&pathrev= > > > > > > [2]: > > http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/htdocs/modules/asis/?pathrev=1885573 > > > > Hi, > > I forgot to add, that the directive that you seem to be looking for is > ErrorDocument (see > https://httpd.apache.org/docs/2.4/mod/core.html#errordocument) > > CJ --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx