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 Former-commit-id: 73143932199b78961760208a9f20dac62b55f0bd
This commit is contained in:
parent
e8d6c3a699
commit
8660b057bf
@ -197,24 +197,15 @@ export default class DappsStore {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_fetchManifest (manifestHash, count = 0) {
|
_fetchManifest (manifestHash) {
|
||||||
return fetch(`${this._getHost()}/api/content/${manifestHash}/`)
|
return fetch(`${this._getHost()}/api/content/${manifestHash}/`, { redirect: 'follow', mode: 'cors' })
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.ok) {
|
return response.ok
|
||||||
return response.json();
|
? response.json()
|
||||||
}
|
: null;
|
||||||
|
|
||||||
if (count < 1) {
|
|
||||||
return this._fetchManifest(manifestHash, count + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((error) => {
|
||||||
if (count < 1) {
|
console.warn('DappsStore:fetchManifest', error);
|
||||||
return this._fetchManifest(manifestHash, count + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,8 @@ module.exports = {
|
|||||||
proxy: {
|
proxy: {
|
||||||
'/api/*': {
|
'/api/*': {
|
||||||
target: 'http://127.0.0.1:8080',
|
target: 'http://127.0.0.1:8080',
|
||||||
changeOrigin: true
|
changeOrigin: true,
|
||||||
|
autoRewrite: true
|
||||||
},
|
},
|
||||||
'/app/*': {
|
'/app/*': {
|
||||||
target: 'http://127.0.0.1:8080',
|
target: 'http://127.0.0.1:8080',
|
||||||
|
Loading…
Reference in New Issue
Block a user