是否有可能获得服务器端的查询参数?我部署了我的Angular应用程序的Lambda Cloudfront版本。
当平台浏览器运行时,一切都运行得很好。
当我试图在服务器端获取查询参数时,我总是得到null/undefined。
我已经尝试过了:
ngOnInit(): void {
this.queryId = this.route.snapshot.queryParamMap.get('id');
this.metaPlatform.addTag({ property: this.queryId, content: this.queryId });
}
//I get this meta tag:
<meta property="null" content="null">并且还尝试了这个:
ngOnInit(): void {
const snapshot = this.router.routerState.snapshot;
this.meta.addTag({property: snapshot.url.split('=')[1],content: snapshot.url.split('=')[1]);
}
//I get this meta tag:
<meta property="undefined" content="undefined">我想设置基于queryParams的元标签,但我找不到一种方法让它们在服务器端。
发布于 2020-09-24 20:32:09
似乎是CloudFront配置问题。
在CloudFront created Behavior中,检查“查询字符串转发和缓存”是否配置为转发特定参数或所有参数。
https://stackoverflow.com/questions/64045999
复制相似问题