【问题标题】:Apache2 is changing my content type for a Ruby cgi scriptApache2 正在更改我的 Ruby cgi 脚本的内容类型
【发布时间】:2009-08-23 10:12:32
【问题描述】:

我有一个 ruby​​ cgi 脚本,它的输出如下:

cgi.out("Cache-Control" => "no-cache, must-revalidate",
        "type"       => "text/html",
        "charset"    => "UTF-8") {
  template.result(binding)
}

不幸的是,当我从 cURL 查看标题时,我看到以下内容:

< HTTP/1.1 200 OK
< Date: Sun, 23 Aug 2009 09:48:03 GMT
< Server: Apache/2.2.11 (Ubuntu) DAV/2 SVN/1.5.4 PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch mod_ssl/2.2.11 OpenSSL/0.9.8g
< 5541-Content-Type: text/html; charset=UTF-8
< Cache-Control: no-cache, must-revalidate
< Content-Length: 2495
< Cache-Control: max-age=86400
< Expires: Mon, 24 Aug 2009 09:48:03 GMT
< Content-Type: application/x-ruby

它正在重命名我的 Content-Type,并添加第二个缓存控制标头。显然我有一些错误配置。

【问题讨论】:

    标签: ruby apache2


    【解决方案1】:

    原来有一个调试“打印”语句在 cgi.out() 行之前执行。这导致了一些文本作为标题的前缀。

    【讨论】:

      猜你喜欢
      • 2014-05-31
      • 2017-10-16
      • 2016-05-27
      • 1970-01-01
      • 1970-01-01
      • 2011-08-02
      • 2018-10-15
      • 2020-04-07
      • 2014-02-28
      相关资源
      最近更新 更多