如何防止缓存/cookie 影响生产 Rails 应用程序中 ckeditor javascript 文件的路径?
我构建了一个 Rails 应用程序,其中使用 ckeditor 3.5.1 和 ckeditor gem。
在开发中运行时,一切正常。但是当我在生产中运行时,我会收到错误。有时,带有 ckeditor 的 text_area 不会显示。但当我清除缓存和 cookie 时,一切正常。然后过了一会儿,错误又出现了。该错误经常出现。
更仔细的调查显示,当错误发生时,一些像 staging.domain.com/javascripts/ckeditor/config.js 这样的文件是从 staging.domain.com/posts/config.js 请求的,而这些文件自然是不存在的 (帖子来自我的帖子模型)
缓存/cookie 如何影响文件的服务路径? 有谁知道还有什么可能是错的以及我该如何解决它?
PS 我在生产中使用 Phusion 乘客。
I have a built a rails app in which I am using the ckeditor 3.5.1 together with the ckeditor gem.
When running in development, everything works fine. But when I run in production, I get errors.Sometimes, the text_area with the ckeditor does not show up. But when I clear my cache and cookies, everything works fine. Then after a while, the error comes up again. The error comes up more often than not.
Closer investigation reveals that when the error occurs, some files like staging.domain.com/javascripts/ckeditor/config.js are instead being requested from staging.domain.com/posts/config.js which is naturally non-existent
(posts is from my Post model)
How can the cache/cookies affect which path the files are served from?
Does anyone know what else might be wrong and how I can fix it?
P.S. I am using Phusion passenger in production.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题似乎是由激活的 mod_pagespeed 引起的。通过禁用它,一切都恢复正常。
不过我很好奇这是怎么发生的。
It would seem the problem was being cased by mod_pagespeed which was activated. By disabling it, everything came back to normal.
I am curious though, about how this was happening.