You can easily and securely create an SSH tunnel to your ETH Node from the application server. This way, the ETH node is fooled into believing that the connection is from localhost and you can ensure that only the holder of a private key can access.
This is a link to instructions on how to setup certificate based authentication
It is important to setup certificate authentication because else you can not automate the process.
Once you have set that up you can create a tunnel by running a command like:
ssh -f -N -L 9545:localhost:8545 [email protected]
The port numbers are different in my example, in order for the reader to be able to tell them apart. There is absolutely no other reason to make them different.
Once this command has been issued all traffic to port 9545
on localhost
will be forwarded to remotehost.remotedomain.tld:8545
which will consider it to have originated from localhost
and be targeted at localhost:8545
This way, you can keep your ETH node behind a firewall and not open it up to the world but still centralize the functionality.
In order to use this in production, you will have to solve the issue of disconnecting SSH sessions.
--rpccorsdomain
may be what I'm looking for. I think you can specify--rpccorsdomain "*"
which will allow anyone to access the RPC server. I'm sure you can also use a reverse proxy to achieve this as well. I based my information off of this repo: github.com/Kunstmaan/docker-ethereumrpccorsdomain
is what you want, consider answering your own question.CORS
is enforced by browsers. It's a security measure to prevent cross site scripting and DDOS attacks by essentially preventing the masses who use plain browsers to accidentally do something stupid. However an attacker may freely disregard any CORS requests the server sends back. It should not be used as a security precaution.