English 中文(简体)
HTTP_IF_MODIFIED_SINCE 不是通过铁路机(Nginx, 旅客)的头盔
原标题:HTTP_IF_MODIFIED_SINCE header not passed to Rails app (Nginx, Passenger)

I am trying to use the HTTP_IF_MODIFIED_SINCE header in my app to determine if resources are stale/fresh and render 200/304 in those cases. In my dev environment everything works fine but I can t for the life of me get it to work in production.

我正在使用旅客3.0.11和Nginx1.0.13。

As you see below, I tried proxy_pass_header, proxy_set_header, passenger_pass_header and passenger_set_cgi_param. The last one actually sets a HTTP_IF_MODIFIED_SINCE header but it is empty... Any help/ideas would be greatly appreciated!

我的想象力:

server {
  listen             80 default_server;
  root               /home/rails/myapp/current/public;
  passenger_enabled  on;
  charset            utf-8;

  proxy_pass_header If-Modified-Since;
  proxy_set_header If-Modified-Since $http_if_modified_since;
  passenger_pass_header If-Modified-Since;
  passenger_set_cgi_param HTTP_IF_MODIFIED_SINCE $http_if_modified_since;

  if (-f $document_root/system/maintenance.html) {
    rewrite ^(.*)$ /system/maintenance.html break;
  }

  location ~ .(aspx|jsp|cgi)$ {
    return 410;
  }

  location ~ ^/(assets)/ {
    # http://guides.rubyonrails.org/asset_pipeline.html#server-configuration
    # gzip_static on;
    expires     1y;
    add_header  Cache-Control public;

    add_header Last-Modified "";
    add_header ETag "";
    break;
  }
}
最佳回答

这毕竟是一个用户错误。 我以错误格式将头盔送至照相机(>IF_MODIFIED_SINCE,而不是If-Modised-Since)。 在确定这一点后,它没有任何附加指示。

问题回答

使其与非标准头目合作,其中含有强调内容,在您的网页或原始服务器栏目中这样做。 专栏:

underscores_in_headers on;
ignore_invalid_headers off;

and in the server block:

proxy_pass_header HTTP_IF_MODIFIED_SINCE

如果你拥有你需要处理的、并包含着强调的《吉大港山区倡议》主人的话,这是有益的。





相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签