You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2010/12/28 21:37:18 UTC

DO NOT REPLY [Bug 50525] New: Header directive won't edit Location header from ProxyPass or RewriteRule

https://issues.apache.org/bugzilla/show_bug.cgi?id=50525

           Summary: Header directive won't edit Location header from
                    ProxyPass or RewriteRule
           Product: Apache httpd-2
           Version: 2.2.15
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: mod_headers
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: lmeyer@vmware.com


mod_header documentation and internet discussion seemed to indicate that I
could fix a mistaken Location: header using the Header directive. However, this
did not seem to work in the two cases that I tried.

1. ProxyPass:

ProxyPass / http://google.com/
# which of course gets a 301 to www.google.com
Header always edit Location: goo gar
# so we should go to www.gargle.com
Header always add X-Foo: bar
# just put that in to make sure Header was working at all

The response in this case includes these headers:
X-Foo: bar
Location: http://www.google.com/

So, Location was unaffected.

2. RewriteRule

RewriteEngine on
RewriteRule ^.* http://www.foo.com/ [R]
# so everything is redirected to www.foo.com
Header always edit Location: foo bar
# which should modify it to www.bar.com
Header always add X-Foo: bar

The response then includes:
X-Foo: bar
Location: http://www.foo.com/

Again, Location was unaffected.

If the Location header is added with Header, then a later edit does work. But I
can't get it to affect proxied responses, which is what I really wanted. The
docs don't indicate any reason why this should fail. So either the docs or
mod_headers should be fixed.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 50525] Header directive won't edit Location header from ProxyPass or RewriteRule

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50525

--- Comment #4 from Luke Meyer <lm...@vmware.com> 2010-12-29 08:55:29 EST ---
(In reply to comment #1)
> A workaround is to duplicate your rule and use the same rule with always and
> onsuccess.

This does modify the Location header from ProxyPass, so hopefully my problem is
solved. Interestingly, it doesn't modify the header if it's from RewriteRule.

Thanks a lot for the explanation about headers being stored in multiple ways.
That makes some sense; of course it would be nice if these directives all
operated as expected... but I see it's complicated.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 50525] Header directive won't edit Location header from ProxyPass or RewriteRule

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50525

Eric Covener <co...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |covener@gmail.com

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 50525] Header directive won't edit Location header from ProxyPass or RewriteRule

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50525

--- Comment #2 from Eric Covener <co...@gmail.com> 2010-12-28 18:03:29 EST ---
This is quite broken on a number of levels, but maybe can be made better.

Apache uses two locations to store output headers, and currently mod_headers
treats one of them as "onsuccess" and another as "always" but this is not how
apache modules use them. mod_headers needs to try harder to treat "always" (or
some new cop-out option) as "modify both carefully".

When mod_headers is asked to...
  append [always], it still might not choose so well. 
  add/remove [always], it should be able to figure out the right thing
  edit [always], it should try to edit both

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 50525] Header directive won't edit Location header from ProxyPass or RewriteRule

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50525

--- Comment #3 from Eric Covener <co...@gmail.com> 2010-12-28 22:35:37 EST ---
I've tried to explain this in a doc update:

http://svn.apache.org/viewvc?view=revision&revision=1053523

But we should keep the bug as a non-doc bug since this stuff is so difficult to
use.  I struck out trying to fix mod_headers to really try to interpet "always"
with respect to edit/merge/set/add.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 50525] Header directive won't edit Location header from ProxyPass or RewriteRule

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50525

--- Comment #1 from Eric Covener <co...@gmail.com> 2010-12-28 17:33:30 EST ---
A workaround is to duplicate your rule and use the same rule with always and
onsuccess.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org