在Google Appengine的app.yaml中定义查询参数 [英] Define query param in app.yaml in Google Appengine
问题描述
我想根据查询参数提供静态文件。更具体地说,我想为搜索引擎优化提供预渲染的快照。这些网页位于Google Appengine上,因此我使用app.yaml来定义这些网址。
处理程序:
$ p $但是,当我使用查询参数
#考虑任何匹配点静态内容的东西。
- url:/(.*\..*)$
static_files:dist / \ 1
上传:dist /(.* \ .. *)$
#为快照seo
- url:/?_escaped_fragment_=(.*)
static_files:dist / snapshots / \ 1
上传:dist /(.*) $
#否则让Angular处理它。
- url:/(.*)
static_files:dist / index.html
上传:dist / index.html
_escaped_fragment _
获取url时,会触发最后一个url处理程序。有没有可能在url中定义查询参数?如果是这样,我做错了什么?解决方案我很高兴被证明是错误的,但我很确定在通过
app.yaml
进行分派时,不会考虑查询参数。I would like to serve static files depending on the query parameter. More specificly I would like to serve prerendered snapshots for search engine optimalization. The pages are hosted on Google Appengine, so I'm using app.yaml to define these urls.
handlers: # Consider anything matching a dot static content. - url: /(.*\..*)$ static_files: dist/\1 upload: dist/(.*\..*)$ # Serve snapshots for seo - url: /?_escaped_fragment_=(.*) static_files: dist/snapshots/\1 upload: dist/(.*)$ # Otherwise let Angular handle it. - url: /(.*) static_files: dist/index.html upload: dist/index.html
However, when I fetch a url with the query parameter
_escaped_fragment_
, the last url handler is triggered. Is it possible to define query params in urls? If so, what am I doing wrong?解决方案I'm happy to be proven wrong, but I'm pretty sure that query parameters aren't considered when dispatching via
app.yaml
.这篇关于在Google Appengine的app.yaml中定义查询参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!