【问题标题】:apache mod_headers Date: Headerapache mod_headers 日期:标题
【发布时间】:2013-05-13 22:52:24
【问题描述】:

各位, 需要将以下请求头转换为不同的格式:

RequestHeader set Date "%{TIME_WDAY}e"

%t 变量看起来像:

t=1367272677754275

希望 Date= 看起来像:

Date: Tue, 27 Mar 2007 19:44:46 +0000

这是怎么做到的?

谢谢!

【问题讨论】:

  • %t 是否来自mod_headers
  • 这里的上下文是什么?您在为 Web 应用程序提供服务吗?如果是,您可以直接在您的 Web 应用程序中设置 Date 标头吗?

标签: apache mod-headers


【解决方案1】:

您无法使用 mod_headers 的记录功能做到这一点。该模块仅支持以下变量(来自doc):

%t          The time the request was received in Universal Coordinated Time since the epoch (Jan. 1, 1970) measured in microseconds. The value is preceded by t=.
%D          The time from when the request was received to the time the headers are sent on the wire. This is a measure of the duration of the request. The value is preceded by D=. The value is measured in microseconds.
%{FOOBAR}e  The contents of the environment variable FOOBAR.
%{FOOBAR}s  The contents of the SSL environment variable FOOBAR, if mod_ssl is enabled.

除非您一直想将环境变量设置为当前日期并使用mod_env 将其拉入,否则我建议您使用mod_rewrite

【讨论】:

    【解决方案2】:

    这里的正确答案是一个 mod_headers.c 补丁,用于添加 AWS 和 GCS 所需的额外身份验证信息

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-28
      • 2018-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-21
      • 1970-01-01
      相关资源
      最近更新 更多