与认证REST请求缓存代理 [英] Caching proxy with authenticated REST requests

查看:165
本文介绍了与认证REST请求缓存代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请考虑以下情形:


  • 我的RESTful URL /条,返回文章列表

  • 的用户使用上的每个请求授权HTTP标头提供了他的证件

  • 文章可能会有所不同,从用户到用户根据自己的权限

其可以使用缓存代理,如鱿鱼,对于这种情况?
代理服务器只能看到URL /条,因此它可能返回的文章仅适用于产生缓存第一个用户列表。其他用户请求的URL /制品可以看到物品,他们没有获得,这是不希望的,当然

Its possible to use caching proxy, like Squid, for this scenario? Proxy will see only URL /articles so it may return list of articles only valid for first user that generates the cache. Other users requesting URL /articles can see articles they don't have access to, which is not desirable of course.

我应该推出自己的缓存或某些高速缓存代理软件可以被配置为基础对授权HTTP标头缓存?

Should I roll my own cache or some caching proxy software can be configured to base its cache on Authorization HTTP header?

推荐答案

一种可能尝试使用有所不同:授权响应头指示下游缓存要小心基于请求的授权头改变缓存文件缓存。

One possibility to try is using the Vary: Authorization response header to instruct downstream caches to be careful about caching by varying the cached documents based on the request's Authorization header.

如果您使用响应-COM pression您可能已经在使用此头。用户一般要求的资源与头接受编码:gzip,紧缩;如果服务器被配置为支持COM pression,那么响应可能附带标题内容编码:gzip 有所不同:可接受编码了。

You may already be using this header if you use response-compression. The user generally requests a resource with the header Accept-Encoding: gzip, deflate; if the server is configured to support compression, then the response might come with the headers Content-Encoding: gzip and Vary: Accept-Encoding already.

这篇关于与认证REST请求缓存代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆