Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.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
如何忽略承载CDN的firebase上的查询字符串?_Firebase_Google Cloud Functions_Firebase Hosting - Fatal编程技术网

如何忽略承载CDN的firebase上的查询字符串?

如何忽略承载CDN的firebase上的查询字符串?,firebase,google-cloud-functions,firebase-hosting,Firebase,Google Cloud Functions,Firebase Hosting,嗨,我的firebase主机中有一个URL,我们称之为/success.html 用例中,用户向我的http云函数实例发出http请求,成功后,我将使用查询字符串将请求重定向到/success.html。下面是一个例子:success.html/id=?foo 问题是我想通过firebase CDN提供/success.html,但firebase托管CDN会处理每个查询字符串唯一的缓存键。因此success.html/id=?foo和success.html/id=?bar不会命中相同的缓存键

嗨,我的firebase主机中有一个URL,我们称之为
/success.html

用例中,用户向我的http云函数实例发出http请求,成功后,我将使用查询字符串将请求重定向到
/success.html
。下面是一个例子:
success.html/id=?foo

问题是我想通过firebase CDN提供
/success.html
,但firebase托管CDN会处理每个查询字符串唯一的缓存键。因此
success.html/id=?foo
success.html/id=?bar
不会命中相同的缓存键

我可以从缓存键中省略查询字符串吗?所以
success.html/id=?这里的任何id
都将返回从
/success.html
缓存的资源


谢谢

根据您的描述,模板引擎实际上是您想要使用的,而不是在CDN接收数据时重定向到静态文件。

为什么您希望具有不同查询的请求命中所有相同的缓存?如果参数发生变化,那么它们应该到达后端。另外,您的查询字符串的格式不正确,应该是“success.html?id=foo”而不是“success.html/id=?foo”。我的想法是,我不想在我的云函数上安装任何模板引擎来最小化依赖性,所以我只是将其重定向到带有查询字符串的静态html页面。我通过将请求重定向到URL上带有查询字符串的静态页面来发送服务器生成的ID,然后在客户端解析查询字符串并将其显示在屏幕上,如“您的ID是:xxxx”。感谢您指出查询字符串错误。我“解决”了这个问题,我在Netlify上托管了我的静态页面,它们不会缓存查询字符串。模板引擎将扩大我的功能大小,与CDN相比速度较慢。但是谢谢你的回复。