Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug #1

Closed
DevkoDev opened this issue Oct 13, 2020 · 4 comments
Closed

bug #1

DevkoDev opened this issue Oct 13, 2020 · 4 comments

Comments

@DevkoDev
Copy link
Contributor

image
why this bug occurred ?

@DevkoDev DevkoDev changed the title can't use http bug Oct 13, 2020
@DevkoDev
Copy link
Contributor Author

DevkoDev commented Oct 13, 2020

i coded this little code and it worked but i think something missing
const express = require('express');
const bodyParser = require('body-parser');

const {
createProxyMiddleware
} = require('http-proxy-middleware');
const app = express();
app.use(bodyParser.json());
const PORT = 4000;
const HOST = "0.0.0.0";
const API_SERVICE_URL = 'http://localhost:9009'
const methods = [
'dna_identity',
'dna_ceremonyIntervals',
'dna_epoch',
'dna_isValidationReady',
'dna_wordsSeed',
'dna_getBalance',
'flip_getRaw',
'flip_getKeys',
'flip_shortHashes',
'flip_longHashes',
'flip_privateEncryptionKeyCandidates',
'flip_sendPrivateEncryptionKeysPackage',
'flip_sendPublicEncryptionKey',
'bcn_syncing',
'bcn_getRawTx',
'bcn_sendRawTx',
]
app.get('', (req, res, next) => {
res.send('Hello , please donate > 0xe151841d51527e5e8261a32ea78074e93224e882');
});
app.use('', createProxyMiddleware({
target: API_SERVICE_URL,
changeOrigin: true,
secure : true,
onProxyReq(proxyReq, req, res) {
if (methods.indexOf(req.body.method) === -1) {
proxyReq.destroy()
res.status(403).send('Method fobidden')
return
}

}

}));
app.listen(PORT, HOST, () => {
console.log(Starting Proxy at ${HOST}:${PORT});
});
however i also tried using using 0.0.0.0 as rpcaddr and it exposed the port to the internet and it also didn't work on the app but worked on the normal client

@midenaio
Copy link
Member

https:// is required for the shared node connection

@DevkoDev
Copy link
Contributor Author

image

@DevkoDev
Copy link
Contributor Author

i have fixed the https thing and now i got this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants