diff --git a/js/src/api/transport/ws/ws.js b/js/src/api/transport/ws/ws.js index 6edbef37f..934daa5ad 100644 --- a/js/src/api/transport/ws/ws.js +++ b/js/src/api/transport/ws/ws.js @@ -102,12 +102,7 @@ export default class Ws extends JsonRpcBase { } _checkNodeUp () { - const url = process.env.PARITY_URL || window.location.host; - - return fetch( - `http://${url}/api/ping`, - { method: 'HEAD' } - ) + return fetch('/', { method: 'HEAD' }) .then((r) => { return r.status === 200; }, () => { diff --git a/js/src/redux/providers/status.js b/js/src/redux/providers/status.js index 7bae14bc8..2153d1ddf 100644 --- a/js/src/redux/providers/status.js +++ b/js/src/redux/providers/status.js @@ -102,7 +102,7 @@ export default class Status { }, timeout); }; - fetch('/api/ping', { method: 'HEAD' }) + fetch('/', { method: 'HEAD' }) .then((response) => dispatch(!!response.ok)) .catch(() => dispatch(false)); } diff --git a/js/src/secureApi.js b/js/src/secureApi.js index cb011f02a..1b86b48f5 100644 --- a/js/src/secureApi.js +++ b/js/src/secureApi.js @@ -30,7 +30,7 @@ export default class SecureApi extends Api { this._signerPort = 8180; 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._followConnection(); diff --git a/js/webpack.config.js b/js/webpack.config.js index 91a9caf2e..b70123aff 100644 --- a/js/webpack.config.js +++ b/js/webpack.config.js @@ -197,30 +197,42 @@ module.exports = { historyApiFallback: false, quiet: false, hot: !isProd, - proxy: { - '/api/*': { + proxy: [ + { + 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', changeOrigin: true, autoRewrite: true }, - '/app/*': { + { + context: '/app/*', target: 'http://127.0.0.1:8080', changeOrigin: true, pathRewrite: { '^/app': '' } }, - '/parity-utils/*': { + { + context: '/parity-utils/*', target: 'http://127.0.0.1:3000', changeOrigin: true, pathRewrite: { '^/parity-utils': '' } }, - '/rpc/*': { + { + context: '/rpc/*', target: 'http://localhost:8080', changeOrigin: true } - } + ] } };