Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services CloudFront的缓存重定向,但传递唯一的查询字符串参数_Amazon Web Services_Amazon Cloudfront - Fatal编程技术网

Amazon web services CloudFront的缓存重定向,但传递唯一的查询字符串参数

Amazon web services CloudFront的缓存重定向,但传递唯一的查询字符串参数,amazon-web-services,amazon-cloudfront,Amazon Web Services,Amazon Cloudfront,我正在尝试使以下行为适用于Cloudfront缓存 cloudfronturl.com/path?code=1234 -> Cache Miss 302 redirect to abc123.com?code=1234 cloudfronturl.com/path?code=1235 -> Cache Hit 302 redirect to abc123.com?code=1235 现在,我让它缓存重定向,但它没有转发查询字符串,其行为如下: cloudfronturl.com/p

我正在尝试使以下行为适用于Cloudfront缓存

cloudfronturl.com/path?code=1234 -> Cache Miss 302 redirect to abc123.com?code=1234
cloudfronturl.com/path?code=1235 -> Cache Hit 302 redirect to abc123.com?code=1235
现在,我让它缓存重定向,但它没有转发查询字符串,其行为如下:

cloudfronturl.com/path?code=1234 -> Cache Miss 302 redirect to abc123.com?code=1234 (as expected)
cloudfronturl.com/path?code=1235 -> Cache Hit 302 redirect to abc123.com?code=1234 (wrong query parameter value for code)
我基本上总是将任何请求转发到特定的域,但是代码的值可能会改变。我想缓存一些选项查询字符串参数,以便它们转到不同的域,如下所示:

cloudfronturl.com/path?code=1234&country=CA -> Cache Miss 302 redirect to abc123.ca?code=1234
cloudfronturl.com/path?code=1235&country=MX -> Cache Miss 302 redirect to abc123.mx?code=1235

有没有办法让Cloudfront以这种方式运行,或者我总是必须将我的请求转发给重定向lambda,因为我想转发唯一的值。

IIRC在“缓存行为”下有一个切换,可以将查询字符串包含在缓存中,但为此,您可能需要特别设置lambda@edge.Yea,我将请求转发给lambda@edge这样就行了。试图避免不必要的调用,但不确定这是否可行。我确实设置了在缓存中包含查询字符串的设置,但我认为这就是返回错误的代码查询字符串值的原因。