Fixed ping and comment #3587

This commit is contained in:
Nicolas Gotchac 2016-11-23 18:08:53 +01:00
parent ab212fcdb5
commit bb6fe16478
4 changed files with 21 additions and 14 deletions

View File

@ -102,12 +102,7 @@ export default class Ws extends JsonRpcBase {
} }
_checkNodeUp () { _checkNodeUp () {
const url = process.env.PARITY_URL || window.location.host; return fetch('/', { method: 'HEAD' })
return fetch(
`http://${url}/api/ping`,
{ method: 'HEAD' }
)
.then((r) => { .then((r) => {
return r.status === 200; return r.status === 200;
}, () => { }, () => {

View File

@ -102,7 +102,7 @@ export default class Status {
}, timeout); }, timeout);
}; };
fetch('/api/ping', { method: 'HEAD' }) fetch('/', { method: 'HEAD' })
.then((response) => dispatch(!!response.ok)) .then((response) => dispatch(!!response.ok))
.catch(() => dispatch(false)); .catch(() => dispatch(false));
} }

View File

@ -30,7 +30,7 @@ export default class SecureApi extends Api {
this._signerPort = 8180; this._signerPort = 8180;
this._followConnectionTimeoutId = null; this._followConnectionTimeoutId = null;
// Try tokens from hash, then from localstorage // Try tokens from localstorage, then from hash
this._tokensToTry = [ sysuiToken, nextToken ].filter((t) => t && t.length); this._tokensToTry = [ sysuiToken, nextToken ].filter((t) => t && t.length);
this._followConnection(); this._followConnection();

View File

@ -197,30 +197,42 @@ module.exports = {
historyApiFallback: false, historyApiFallback: false,
quiet: false, quiet: false,
hot: !isProd, hot: !isProd,
proxy: { proxy: [
'/api/*': { {
context: (pathname, req) => {
return pathname === '/' && req.method === 'HEAD';
},
target: 'http://127.0.0.1:8180',
changeOrigin: true,
autoRewrite: true
},
{
context: '/api/*',
target: 'http://127.0.0.1:8080', target: 'http://127.0.0.1:8080',
changeOrigin: true, changeOrigin: true,
autoRewrite: true autoRewrite: true
}, },
'/app/*': { {
context: '/app/*',
target: 'http://127.0.0.1:8080', target: 'http://127.0.0.1:8080',
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/app': '' '^/app': ''
} }
}, },
'/parity-utils/*': { {
context: '/parity-utils/*',
target: 'http://127.0.0.1:3000', target: 'http://127.0.0.1:3000',
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/parity-utils': '' '^/parity-utils': ''
} }
}, },
'/rpc/*': { {
context: '/rpc/*',
target: 'http://localhost:8080', target: 'http://localhost:8080',
changeOrigin: true changeOrigin: true
} }
} ]
} }
}; };