input-output-hk / stakepool-management-tools

27 stars 7 forks source link

problems tunneling to local laptop #59

Open marimes opened 4 years ago

marimes commented 4 years ago

I try to use spmt locally and created an ssh tunnel with:

ssh -p <port> -i ~/.ssh/<key> -L 43100:localhost:3100 user@host.com

When I test the tunnel with

jcli rest v0 settings get --host "http://localhost:43100/api

I get the desired output showing that the tunnel works.

When I yarn start the electron app and then enter http://localhost:43100 as the node's rest address I get the error Error connecting to node.

How should I set this up?

lgobbi-atix commented 4 years ago

This may be because you are starting the app in development mode by running yarn start and the requests to the node are being blocked by CORS. I suggest installing SPM with the provided installers under releases.

Anyway, if you still want to use the app in development mode you will need to add the CORS configuration to the node config file inside the rest property. Just add your address and port where the app is running (3000 by default) as an allowed origin and restart the node. You can find the documentation here. It should be something like:

"rest": {
    "listen": "127.0.0.1:3100",
    "cors": {
    "allowed_origins": ["http://<ip_address>:<port>"]   
     }
  }