After peering into the seedy underbelly of Apache's query processing system, it turns out that the documentation is somewhat misleading ... But before I get the explanation, from what I can say, you are at the mercy of Apache on this one.
Customer task
-, Vary, . , mod_rewrite .
, apr_table_get(), , :
const char *val = apr_table_get(ctx->r->headers_in, name);
name , NULL. , val:
if (val) {
}
ctx->vary_this RewriteCond , Vary *. , , ( ) Vary. , , .
* , NV ( ) ctx->vary_this NULL, .
, Accept-Language, . , Vary mod_rewrite , . , , :
User-Agent: Fiddler
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language:
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Host: 129.168.0.123
, ? mod_rewrite , (ctx->vary ctx->vary_this ):
if (ctx->vary) {
apr_table_merge(r->headers_out, "Vary", ctx->vary);
}
, r->headers_out - , . , - , , .
.htaccess
.htaccess <Directory>. , mod_rewrite Apache, , , . , , ( ).
, . , ap_internal_redirect(). , headers_out .
, mod_rewrite , , () , . , ( <VirtualHost>), ...
, , , mod_rewrite , , , , .
Apache, ap_process_request(). , , ap_process_request_internal(), ( mod_rewrite). , 301.
OK ( 0), ap_finalize_request_protocol(). , :
if (access_status == OK) {
ap_finalize_request_protocol(r);
}
else {
r->status = HTTP_OK;
ap_die(access_status, r);
}
ap_die() (, 301), ap_send_error_response().
, , , . , , "", . :
if (!r->assbackwards) {
apr_table_t *tmp = r->headers_out;
r->headers_out = r->err_headers_out;
r->err_headers_out = tmp;
apr_table_clear(r->err_headers_out);
if (ap_is_HTTP_REDIRECT(status) || (status == HTTP_CREATED)) {
if ((location != NULL) && *location) {
apr_table_setn(r->headers_out, "Location", location);
}
}
}
, r->headers_out , . , , .
, . , . , , , .
Vary: Accept-Encoding, , , , . , Gumbo .
2.2.14 2.2 , Apache 2.2.15, -, .