Rails heroku应用程序上的Robots.txt文件没有更新

Jam*_*s C 4 robots.txt ruby-on-rails heroku

我有一个在Heroku上托管的rails应用程序,我正在尝试更新robot.txt文件.

本地文件位于/public/robots.txt:

User-agent: *
Disallow: /admin/
Run Code Online (Sandbox Code Playgroud)

但是,当我将应用程序部署到Heroku时,机器人文件似乎没有更新.远程版本为:

# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the     robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
User-agent: *
Disallow: /
Run Code Online (Sandbox Code Playgroud)

实时网址是http://www.cowboypicks.com/robots.txt.

运行curl -I http://www.cowboypicks.com/robots.txt收益率:

HTTP/1.1 200 OK
Age: 2317078
Cache-Control: public, max-age=2592000
Content-length: 200
Content-Type: text/plain
Date: Wed, 30 Apr 2014 17:01:43 GMT
Last-Modified: Thu, 03 Apr 2014 14:21:08 GMT
Status: 200 OK
X-Content-Digest: 10c5b29b9aa0c6be63a410671662a29a796bc772
X-Rack-Cache: fresh
Connection: keep-alive
Run Code Online (Sandbox Code Playgroud)

表明该文件自4月3日起尚未更新,但今天(4月30日)已更新.更奇怪的是,当我跑步时heroku run bash,cat public/robots.txt我得到:

User-agent: *
Disallow: /admin/
Run Code Online (Sandbox Code Playgroud)

指示文件正在Heroku上更新,但由于某种原因它显示较旧的(我假设缓存)版本.使用dalli/memcache在应用程序上有一些缓存,但我不认为这会影响静态文件?关于如何进一步调试问题的任何想法?

Jam*_*s C 9

事实证明,Dalli确实在生产中缓存了robots.txt文件.到期日期production.rb与行一起设置:

 config.static_cache_control = "public, max-age=2592000"
Run Code Online (Sandbox Code Playgroud)

从rails控制台运行以下内容会刷新缓存并对问题进行排序:

Rails.cache.dalli.flush_all
Run Code Online (Sandbox Code Playgroud)