多页网址后备广告(index.html和subpage.html)

时间:2018-09-10 18:55:44

标签: google-app-engine google-app-engine-python

我正在尝试使用Google Apps python引擎部署多页Vue.js应用。

为了使Vue.js应用程序正常工作,我需要所有URL都回退,以便vue javascript路由器可以接管。

Index.html链接

  

/ foo

     

/条

     

/ foo / bar

Subpage.html链接

  

/ subpage / foo

     

/子页面/栏

     

/ subpage / foo / bar

在我当前的配置中,如果我从索引中删除了通配符,则可以访问该子页面,但是索引链接不再起作用。是否有可能实现多个回退,首先是“ /”,其次​​是“ / subpage /”?

我已经包含了我的app.yaml,我认为它应该按书面形式工作,但不起作用。

runtime: python27
api_version: 1
threadsafe: true

handlers:
  # Fonts and images
  - url: /(.+\.(eot|otf|tt[cf]|woff2?|cur|gif|ico|jpe?g|png|svgz?|webp))
    static_files: dist/\1
    upload: dist/(.+\.(eot|otf|tt[cf]|woff2?|cur|gif|ico|jpe?g|png|svgz?|webp))
    secure: always
    http_headers:
      Access-Control-Allow-Origin: "*"

  # CSS, Javascript, text and other file types
  - url: /(.+\.(css|js|xml|txt|map))
    static_files: dist/\1
    upload: dist/(.+\.(css|js|xml|txt|map))
    expiration: "10m"
    secure: always

  # HTML pages
  - url: /(.+\.html)
    static_files: dist/\1
    upload: dist/(.+\.html)
    expiration: '10m'
    secure: always
    http_headers:
      X-UA-Compatible: 'IE=edge'

  # Index entry point
  - url: /.*
    static_files: dist/index.html
    upload: dist/index.html
    expiration: '10m'
    secure: always
    http_headers:
      X-UA-Compatible: 'IE=edge'

  # Subpage entry point
  - url: /subpage/.*
    static_files: dist/subpage.html
    upload: dist/subpage.html
    expiration: '10m'
    secure: always
    http_headers:
      X-UA-Compatible: 'IE=edge'


skip_files:
  - ^(.*/)?app\.yaml
  - ^(.*/)?app\.yml
  - ^(.*/)?#.*#
  - ^(.*/)?.*~
  - ^(.*/)?.*/RCS/.*
  - ^(.*/)?\..*
  - ^(.*/)?tests$
  - ^(.*/)?test$
  - ^test/(.*/)?
  - ^COPYING.LESSER
  - ^README\..*
  - \.gitignore
  - ^\.git/.*
  - \.*\.lint$
  - ^node_modules/(.*/)?
  - public/*
  - src/*

1 个答案:

答案 0 :(得分:2)

您的问题是DROP TABLE IF EXISTS捕获了所有尚未捕获的内容。因此,处理程序永远不会到达- url: /.*

/subpage/.*处理程序移至通配符/subpage/.*上方:

- url: /.*