页面刷新时的App Engine为我的angular2项目提供了404? [英] App Engine on page refresh gives 404 for my angular2 project?
问题描述
这个问题与我如何使页面刷新时使用App Engine的Angular 2路由工作?,但我没有足够的观点发表评论,也没有提出问题的答案。
无论如何,除了它是使用角度cli dist文件夹的appspot上的静态托管网站外,其他问题都是相同的:
项目
|
+ - dist
|
+ - index.html
+ - inline.js
+ - inline.map
+ - main.bundle.js
+ - main .map
+ - styles.bundle.js
+ - styles.map
+ - app.yaml
+ - index.yaml
我尝试将我的app.yaml更改为类似于上面链接的Dan的答案,但无法解决这个问题?这里是app.yaml文件:
应用程序:
版本:
运行时:python27
线程安全:true
api_version:1
处理程序:
- url:/(.*\.js)
static_files:dist / \ 1
上传:dist /(.* \.js)
$ b $ url - /(.*\.map)
mime_type:application / octet-stream
static_files :dist / \ 1
上传:dist /(.* \.map)
$ b $ - url:/
static_files:dist / index.html
上传:dist / index.html
$ b $ - url:/(.*)
static_files:dist / \ 1
上传:dist /(.*)
谢谢 试试这个处理程序:
- url:/(.* \。(gif | png | jpg | css | js)( | \.map))$
static_files:dist / \ 1
上传:dist /(。*)(| \.map)
$ b $ - url:/ (。*)
static_files:dist / index.html
上传:dist / index.html
在fir中添加文件扩展名st处理程序,如果你的应用程序使用更多。
适用于我的应用程序...
The question is very similar to How do I make Angular 2 routing work with App Engine on page refresh? but I do not have enough points to comment and it says not to put questions in answers.
Anyway same problem except it's a static hosted site on appspot with angular cli dist folder being used:
Project
|
+--dist
|
+--index.html
+--inline.js
+--inline.map
+--main.bundle.js
+--main.map
+--styles.bundle.js
+--styles.map
+--app.yaml
+--index.yaml
I tried changing my app.yaml to something similar to Dan's answer linked above but can't work it out? Here is the app.yaml file:
application:
version:
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /(.*\.js)
static_files: dist/\1
upload: dist/(.*\.js)
- url: /(.*\.map)
mime_type: application/octet-stream
static_files: dist/\1
upload: dist/(.*\.map)
- url: /
static_files: dist/index.html
upload: dist/index.html
- url: /(.*)
static_files: dist/\1
upload: dist/(.*)
Thanks
try this handlers:
- url: /(.*\.(gif|png|jpg|css|js)(|\.map))$
static_files: dist/\1
upload: dist/(.*)(|\.map)
- url: /(.*)
static_files: dist/index.html
upload: dist/index.html
add file extensions in the first handler if your app uses more.
works for my app...
这篇关于页面刷新时的App Engine为我的angular2项目提供了404?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!