我在Heroku上托管了一个Rails应用,正在尝试为其更新robot.txt文件。
较早,在我的production.rb
中,我有:
config.static_cache_control = "public, max-age=2592000"
但是,我将其更改为:
config.static_cache_control = "public, max-age=0"
并再次将代码推送到生产环境。
我也尝试跑步:Rails.cache.clear
中的heroku rails console
,但/robots.txt
仍在显示旧文件。
编辑:
我已经从public
文件夹中删除了'robots.txt'文件。再次清理和预编译资产也没有用。
我仍然可以在生产环境中访问它。
我发现了问题,缓存在我的Chrome浏览器中。
当我在其他浏览器上检查站点时,robots.txt
已更新。
因此,我清除了chrome浏览器的缓存和cookie,并刷新了/robots.txt
和瞧!文件已更新。