【问题标题】:SailsJs: getting "304 not modified" page after deploySailsJs:部署后获取“304 未修改”页面
【发布时间】:2017-10-30 14:49:53
【问题描述】:

我正在尝试更新我的 SailsJs 应用程序以修复我在 Heroku 上遇到的空白页面,但我得到的状态 304 未从浏览器修改。

我想我已尽我所能修复我的应用程序上的空白页面,但我不知道为什么页面没有在 Heroku 上更新

我的档案:

web: node app.js

如果有人可以提供帮助,我将不胜感激。

谢谢!

【问题讨论】:

    标签: node.js heroku sails.js


    【解决方案1】:

    我认为您不需要解决任何问题。如果您尝试使用 POSTMAN 或其他浏览器调用相同的 url,您应该得到状态 200。

    【讨论】:

      【解决方案2】:

      您可以将其添加到策略中,然后将其应用于您想要的特定页面/请求 - 如果您不想为整个应用程序设置此设置。

      /api/policies/nocache.js:

          /**
           * Sets no-cache header in response.
           */
          module.exports = function (req, res, next) {
              sails.log.info("Applying disable cache policy");
              res.header('Cache-Control', 'private, no-cache, no-store, must-revalidate');
              res.header('Expires', '-1');
              res.header('Pragma', 'no-cache');  
              next();
          };
      

      不要忘记将 nocatch 包含在 config/policy.js 中

      '*': 'nocatche'
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-01-27
        • 1970-01-01
        • 2014-09-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-11-17
        相关资源
        最近更新 更多