Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fixed ping and comment #3587
Browse files Browse the repository at this point in the history
  • Loading branch information
ngotchac committed Nov 23, 2016
1 parent ab212fc commit bb6fe16
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
7 changes: 1 addition & 6 deletions js/src/api/transport/ws/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}, () => {
Expand Down
2 changes: 1 addition & 1 deletion js/src/redux/providers/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion js/src/secureApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
24 changes: 18 additions & 6 deletions js/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
]
}
};

0 comments on commit bb6fe16

Please sign in to comment.