duanluan8390 2014-01-29 22:06
浏览 123
已采纳

app.yaml:URL中带有static_dir的通配符?

My attempt at matching a regex as directory name in app.yaml doesn't work :

- url: /v1_.*
  static_dir: static/v1
  expiration: "364d"

Although this official spec says regex syntax is supported. Is there a way to make this work ?

I.e. /v1_2014-01-29/img/logo.png should match the static file /static/v1/img/logo.png.

Trivia

I use Google App Engine to serve a Go webapp.

I'd like to maximize browser cache longevity, minimize number of requests and still serve the fresh versions of my css/js/png, and I believe revving filenames is a best practice to achieve this. Also as adding a variable querystring (/v1/img/logo.png?2014-01-29) might cause proxy and cache problems, I prefer to show a variable directory name (/v1_2014-01-29/img/logo.png), pointing to the same underlying server dir.

  • 写回答

2条回答 默认 最新

  • douluan5523 2014-01-30 11:11
    关注

    Seems to me that whatever part of the URL that is beyond the match of the url definition (which matches from the start) is appended to the static_dir.

    So the following handler should match /v1_2014-01-29/img/logo.png if the file path is static/v1/img/logo.png (tried with Python):

    - url: /v1_(\d+-?)+
      static_dir: static/v1
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面