Score:0

How to use Apache's mod_rewrite to change the HTTP version in a request?

io flag

I have an old system sending a POST to an old version of Apache(2.4.9) that is not sending the HTTP version. The old system has no issue but I want to update Apache to the latest. When I do, Apache logs an error that only a GET is valid with HTTP/0.9. I tried writing a mod_rewrite to append a version to the request but I still get the errors.

RewriteEngine On  
RewriteCond %{THE_REQUEST} HTTP/0\.9$  
RewriteRule (.*) "$1 HTTP/1.1"
HBruijn avatar
in flag
AFAIK http protocol version 0.9 also doesn’t send a `Host:` so when you only adjust the protocol version you still don’t get a valid http/1.1 request where that header is mandatory
jp flag
Also, there's no version (`HTTP/0.9`) in the request, as it is just `GET /path`.
vidarlo avatar
ar flag
What makes you believe you *can* use mod_rewrite for this purpose?
Scott Kirkpatrick avatar
io flag
Well, you can fail requests for certain HTTP versions.
Scott Kirkpatrick avatar
io flag
I understand that HTTP/0.9 is GET only. However, I have a system not under my control that is sending the following request: POST http://localhost/InsertLine3.php?Date='2023-04-03'&Time='12:11:49'&Line=3&Model='96795400600'&Serial='040323C014086'&UPC='0193028712946'&Returnable='N63-0082422'&Bypass=''&QAHold=''&PASS='Y' It's working on an older version of Apache as stated above and I want to upgrade Apache. If anyone has a better idea of how to handle it, I would appreciate the advice.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.