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 2017/10/02 16:55:56 UTC
[Bug 58231] RewriteCond can add "Host" to the Vary-Header
https://bz.apache.org/bugzilla/show_bug.cgi?id=58231
--- Comment #18 from Luca Toscano <to...@gmail.com> ---
Another solution that I played with (just a hack, nothing complete) is the
following:
Index: modules/http/http_request.c
===================================================================
--- modules/http/http_request.c (revision 1810323)
+++ modules/http/http_request.c (working copy)
@@ -523,6 +523,8 @@
request_rec *r) {
int access_status;
request_rec *new;
+ const char *header_to_copy = NULL;
+ const char *header_values_to_copy = NULL;
if (ap_is_recursion_limit_exceeded(r)) {
ap_die(HTTP_INTERNAL_SERVER_ERROR, r);
@@ -586,6 +588,13 @@
if (location)
apr_table_setn(new->headers_out, "Location", location);
}
+
+ if ((header_to_copy = apr_table_get(r->subprocess_env,
"keep-response-header"))) {
+ if((header_values_to_copy = apr_table_get(r->headers_out,
header_to_copy))) {
+ apr_table_setn(new->headers_out, header_to_copy,
header_values_to_copy);
+ }
+ }
+
new->err_headers_out = r->err_headers_out;
new->trailers_out = apr_table_make(r->pool, 5);
new->subprocess_env = rename_original_env(r->pool, r->subprocess_env);
Index: modules/mappers/mod_rewrite.c
===================================================================
--- modules/mappers/mod_rewrite.c (revision 1810323)
+++ modules/mappers/mod_rewrite.c (working copy)
@@ -5285,6 +5285,8 @@
return DECLINED;
}
+ apr_table_setn(r->subprocess_env, "keep-response-header", "Vary");
+
/* now do the internal redirect */
ap_internal_redirect(apr_pstrcat(r->pool, r->filename+9,
r->args ? "?" : NULL, r->args, NULL), r);
This allows to selectively merge some headers from r->headers_out to the new
request, without:
1) impacting existing code using the ap_internal_redirect since only
mod_rewrite would use it.
2) force error responses after ap_internal_redirect to carry those headers
(like the vary ones).
Not sure if it makes any sense, but I am running out of ideas :)
--
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