How do I make Angular 2 routing work with App Engine on page refresh?

后端 未结 1 1378
深忆病人
深忆病人 2021-01-14 00:38

I am trying to make an Angular 2 app running on App Engine Standard Environment. It works with the following app.yaml configuration when navigating within the a

相关标签:
1条回答
  • 2021-01-14 01:15

    I have a bunch of static files that need to be served so I added their mappings first. I also (most importantly) changed the way index.html was served:

    handlers:
    - url: /api/.*
      script: _go_app
    
    - url: /(.*\.svg)
      static_files: static/\1
      upload: static/(.*\.svg)
    
    - url: /(.*\.js)
      static_files: static/\1
      upload: static/(.*\.js)
    
    - url: /(.*\.map)
      mime_type: application/octet-stream
      static_files: static/\1
      upload: static/(.*\.map)
    
    - url: (.*)/
      static_files: static/index.html
      upload: static
    
    - url: (.*)
      static_files: static/index.html
      upload: static
    
    0 讨论(0)
提交回复
热议问题