SailsJs:部署后获得“304 not modified”页面

时间:2017-10-30 14:49:54

标签: node.js heroku sails.js

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

enter image description here

我想我已经完成了修复应用程序空白页所需的一切,但我不知道为什么页面没有在Heroku上更新

我的Procfile:

web: node app.js

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

谢谢!

2 个答案:

答案 0 :(得分:0)

我认为你不需要修理任何东西。如果您尝试使用POSTMAN或其他浏览器调用相同的URL,则应获得状态200。

答案 1 :(得分:0)

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

<强> /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();
    };

不要忘记将nocatche纳入config / policy.js

'*': 'nocatche'