Bug 54126

Summary: Mod_rewrite failing because of url in query string parameter
Product: Apache httpd-2 Reporter: Mhodges <max>
Component: mod_rewriteAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED LATER    
Severity: major Keywords: MassUpdate
Priority: P2    
Version: 2.2.22   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Mhodges 2012-11-09 18:06:18 UTC
I have this URL rewrite rule

    RewriteRule ^(send-your-request.*)$ / [NC,L,QSA,R=301]

it should basically just remove "/send-your-request" from the the URL (i.e. rewrite it with query string parameters from the domain i.e. 

    http://example.com/send-your-request/?a_aid=betty&pname=just%20a%20test

is rewritten to:

    http://example.com/?a_aid=betty&pname=just%20a%20test

In that cases it works, but if I add the last parameter, it stops working

    http://example.com/send-your-request/?a_aid=betty&pname=just%20a%20test&plink=http%3A%2F%2Fradio-eva.jp%2Fshop%2Fproducts%2Fdetail.php%3Fproduct_id%3D82

The final parameter is a url. If I change the url from "http://" to "htp://" it will work. So apparently it's getting tripped up on the "http" part of that parameter value. Really wish I had a workaround. This is breaking functionality on a live ecommerce site. Also, I did test these rules with some online rewrite rule tools, and they did not fail. But they do fail on my server. So I wonder if the test tools are not modeling the bug.
Comment 1 Eric Covener 2012-11-09 18:15:23 UTC
please attach a rewritelog and double-check the version.
Comment 3 Mhodges 2012-11-09 18:46:58 UTC
(In reply to comment #1)
> please attach a rewritelog and double-check the version.

I don't know how to make a rewritelog. But that doesn't mean this is not a bug.
Comment 4 Eric Covener 2012-11-09 18:51:54 UTC
(In reply to comment #3)
> (In reply to comment #1)
> > please attach a rewritelog and double-check the version.
> 
> I don't know how to make a rewritelog. But that doesn't mean this is not a
> bug.

Nobody said it did. But it does affect how much effort volunteers will spend in looking at the issue.

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritelog
Comment 5 Mhodges 2012-11-09 18:57:27 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #1)
> > > please attach a rewritelog and double-check the version.
> > 
> > I don't know how to make a rewritelog. But that doesn't mean this is not a
> > bug.
> 
> Nobody said it did. But it does affect how much effort volunteers will spend
> in looking at the issue.
> 
> http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritelog

guess I need to hire a consultant in order to submit the bug.
Comment 6 Mhodges 2012-11-09 19:16:28 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #1)
> > > please attach a rewritelog and double-check the version.
> > 
> > I don't know how to make a rewritelog. But that doesn't mean this is not a
> > bug.
> 
> Nobody said it did. But it does affect how much effort volunteers will spend
> in looking at the issue.
> 
> http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritelog

I tried putting the directive in htaccess, but i get internal server error after I do that, so I guess there is a permissions issue with setting the directive there.

I thought maybe I could edit httpd.conf but actually it seems you can't edit that file directly, but you must edit some other file then rebuild httpd.conf somehow. Can you tell me:
1) which file to edit to insert the directive?
2) how to edit that file? I don't know any unix commands to edit any files.
3) how to rebuild the httpd.conf

Cheers!
Comment 7 Eric Covener 2012-11-09 19:19:47 UTC
Can you describe in more detail what the failure case is? Not rewritten at all? Rewritten incorrectly? Bad response?
Comment 8 Mhodges 2012-11-09 19:36:06 UTC
(In reply to comment #7)
> Can you describe in more detail what the failure case is? Not rewritten at
> all? Rewritten incorrectly? Bad response?

did you see Comment #2? 
Basically nothing happens. url is not rewritten. 

(I'm working on getting a rewritelog, but it might take a few days. I need to hire someone how can do it for me. Seems you need to modify some template or make an include so you can rebuild httpd.conf somehow. Quite a learning curve just to make a log file.) 

someone could probably just setup a quick test to confirm the issue on a test server faster than I can figure out how to make a log file.
Comment 9 Dominic Benson 2012-11-09 20:00:09 UTC
I've tested the rewrite rule and example URLs provided on httpd 2.2.22, in both a <Directory> and in htaccess, and found it worked as intended both times. (That is, the /send-your-request/ was removed from both.)

Can you provide more information about the environment? Is it your own server, or a shared system? What other rules and configuration are present?
Comment 10 William A. Rowe Jr. 2018-11-07 21:08:55 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.