我将Angular 7与Angular服务人员结合使用。但是在部署了新的应用程序版本后,大多数情况下都会出现此错误,并且应用程序仅在刷新后才能运行:
The FetchEvent for "https://example.com/runtime.e0d7b28adf942e10148b.js" resulted in a network error response: the promise was rejected.
ngsw-worker.js:589 Uncaught (in promise) Error: Response not Ok (fetchAndCacheOnce): request for https://example.com/runtime.e0d7b28adf942e10148b.js returned response 504 Gateway Timeout
at PrefetchAssetGroup.<anonymous> (ngsw-worker.js:589)
at Generator.next (<anonymous>)
at fulfilled (ngsw-worker.js:312)
runtime.e0d7b28adf942e10148b.js:1 Failed to load resource: net::ERR_FAILED
Run Code Online (Sandbox Code Playgroud)
这是ngsw-config.json配置:
"index": "/index.html",
"assetGroups": [{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**" …Run Code Online (Sandbox Code Playgroud) 即使用户未登录并尝试打开主页,在重定向到登录页面后,也会显示authError.是否有一种优雅的方法可以防止这种情况,而无需修改Auth组件?这是我加载Auth组件的方式(我使用TinyAuth作为授权适配器):
$this->loadComponent('Auth', [
'loginAction' => [
'controller' => 'Users',
'action' => 'login'
],
'loginRedirect' => [
'controller' => 'Home',
'action' => 'index'
],
'authError' => 'You dont have permissions for that action',
'authenticate' => [
'Form' => [
'fields' => [
'username' => 'email',
'password' => 'password'
],
'scope' => ['Users.active' => true],
'contain' => ['Roles']
]
],
'authorize' => [
'TinyAuth.Tiny' => [
'roleColumn' => 'role_id',
'rolesTable' => 'Roles',
'multiRole' => true,
'pivotTable' => 'roles_users',
'superAdminRole' => null,
'authorizeByPrefix' …Run Code Online (Sandbox Code Playgroud)