cherrypy:关闭静态目录和文件发送Cookies

3 投票
1 回答
792 浏览
提问于 2025-04-17 10:08

我正在用CherryPy开发一个网页应用。我在Chrome浏览器中查看审计信息时,浏览器提示我考虑“关闭与图片、脚本和样式表一起发送的cookies”。

我在网上搜索了这个话题,但没有找到有用的信息。以下是我的配置:

    ...
    ...
    ...
    '/static':
        {
            "tools.caching.on" : True,
            "tools.caching.force" : True,
            "tools.caching.delay" : 0,
            "tools.expires.on" : True,
            "tools.expires.secs" : 60*24*365,
            "tools.gzip.on" : True,
            "tools.gzip.mime_types": ['text/*', 'image/*', 'application/*'],
            "tools.staticdir.on" : True,
            "tools.staticdir.root": abspath(dirname(__file__)),
            "tools.staticdir.dir" : "static"
        },
    ...
    ...

为了明确,我不想继承一些自定义类。我希望使用一些工具或设置一些上面的值,最好是这样。任何帮助都非常感谢。

1 个回答

2

在静态目录的配置部分,把 "tools.sessions.on": False 这个设置改成假(False)就解决了问题。

撰写回答