https://bz.apache.org/bugzilla/show_bug.cgi?id=58231

--- Comment #11 from Luca Toscano <[email protected]> ---
(In reply to Luca Toscano from comment #10)
> While writing tests I discovered that the above configuration does not
> trigger the issue when embedded in a Directory block (with proper stripping
> of starting "/" that don't match) because afaics an internal rewrite happens
> that clears out the outstanding Vary values.

This seems to be a long standing issue already reported by others, and
essentially due to the ap_redirect_internal function not carrying any output
headers already set in the "pre-ap_redirect_internal" request. The following
patch seems to work fine with RewriteConds in Directory context:

Index: modules/http/http_request.c
===================================================================
--- modules/http/http_request.c (revision 1809976)
+++ modules/http/http_request.c (working copy)
@@ -523,6 +523,7 @@
                                                request_rec *r) {
     int access_status;
     request_rec *new;
+    const char *vary_headers;

     if (ap_is_recursion_limit_exceeded(r)) {
         ap_die(HTTP_INTERNAL_SERVER_ERROR, r);
@@ -581,6 +582,12 @@
     new->headers_in      = r->headers_in;
     new->trailers_in     = r->trailers_in;
     new->headers_out     = apr_table_make(r->pool, 12);
+
+    vary_headers = apr_table_get(r->headers_out, "Vary");
+    if(vary_headers) {
+        apr_table_setn(new->headers_out, "Vary", vary_headers);
+    }
+
     if (ap_is_HTTP_REDIRECT(new->status)) {
         const char *location = apr_table_get(r->headers_out, "Location");
         if (location)

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to