Handle redirects from /api/content on manifest.json gracefully (#3315)
* Add redirect follow mode to manifest.json * Remove (now) unused count parameter * autoRewrite: true for dev mode proxy redirects
This commit is contained in:
		
							parent
							
								
									88c9cea04d
								
							
						
					
					
						commit
						90ff810e36
					
				| @ -197,24 +197,15 @@ export default class DappsStore { | ||||
|       }); | ||||
|   } | ||||
| 
 | ||||
|   _fetchManifest (manifestHash, count = 0) { | ||||
|     return fetch(`${this._getHost()}/api/content/${manifestHash}/`) | ||||
|   _fetchManifest (manifestHash) { | ||||
|     return fetch(`${this._getHost()}/api/content/${manifestHash}/`, { redirect: 'follow', mode: 'cors' }) | ||||
|       .then((response) => { | ||||
|         if (response.ok) { | ||||
|           return response.json(); | ||||
|         } | ||||
| 
 | ||||
|         if (count < 1) { | ||||
|           return this._fetchManifest(manifestHash, count + 1); | ||||
|         } | ||||
| 
 | ||||
|         return null; | ||||
|         return response.ok | ||||
|           ? response.json() | ||||
|           : null; | ||||
|       }) | ||||
|       .catch(() => { | ||||
|         if (count < 1) { | ||||
|           return this._fetchManifest(manifestHash, count + 1); | ||||
|         } | ||||
| 
 | ||||
|       .catch((error) => { | ||||
|         console.warn('DappsStore:fetchManifest', error); | ||||
|         return null; | ||||
|       }); | ||||
|   } | ||||
|  | ||||
| @ -198,7 +198,8 @@ module.exports = { | ||||
|     proxy: { | ||||
|       '/api/*': { | ||||
|         target: 'http://127.0.0.1:8080', | ||||
|         changeOrigin: true | ||||
|         changeOrigin: true, | ||||
|         autoRewrite: true | ||||
|       }, | ||||
|       '/app/*': { | ||||
|         target: 'http://127.0.0.1:8080', | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user