[DOCS] Update http server docs with new flags (#21546)
This commit is contained in:
parent
fedcdbc2db
commit
12be83b71c
|
@ -20,53 +20,53 @@ documentation for individual namespaces in the sidebar.
|
|||
|
||||
### HTTP Server
|
||||
|
||||
To enable the HTTP server, use the `--rpc` flag.
|
||||
To enable the HTTP server, use the `--http` flag.
|
||||
|
||||
geth --rpc
|
||||
geth --http
|
||||
|
||||
By default, geth accepts connections from the loopback interface (127.0.0.1).
|
||||
The default listening port is 8545. You can customize address and port using the
|
||||
`--rpcport` and `--rpcaddr` flags.
|
||||
`--http.port` and `--http.addr` flags.
|
||||
|
||||
geth --rpc --rpcport 3334
|
||||
geth --http --http.port 3334
|
||||
|
||||
JSON-RPC method namespaces must be whitelisted in order to be available through
|
||||
the HTTP server. An RPC error with error code `-32602` is generated if you call a
|
||||
namespace that isn't whitelisted. The default whitelist allows access to the "eth"
|
||||
and "shh" namespaces. To enable access to other APIs like account management ("personal")
|
||||
and debugging ("debug"), they must be configured via the `--rpcapi` flag. We do
|
||||
and debugging ("debug"), they must be configured via the `--http.api` flag. We do
|
||||
not recommend enabling such APIs over HTTP, however, since access to these
|
||||
methods increases the attack surface.
|
||||
|
||||
geth --rpc --rpcapi personal,eth,net,web3b
|
||||
geth --http --http.api personal,eth,net,web3b
|
||||
|
||||
Since the HTTP server is reachable from any local application, additional
|
||||
protection is built into the server to prevent misuse of the API from web pages.
|
||||
If you want enable access to the API from a web page, you must configure the
|
||||
server to accept Cross-Origin requests with the `--rpccorsdomain` flag.
|
||||
server to accept Cross-Origin requests with the `--http.corsdomain` flag.
|
||||
|
||||
Example: if you want to use [Remix][remix] with geth, allow requests from the
|
||||
remix domain.
|
||||
|
||||
geth --rpc --rpccorsdomain https://remix.ethereum.org
|
||||
geth --http --http.corsdomain https://remix.ethereum.org
|
||||
|
||||
Use `--rpccorsdomain '*'` to enable access from any origin.
|
||||
Use `--http.corsdomain '*'` to enable access from any origin.
|
||||
|
||||
### WebSocket Server
|
||||
|
||||
Configuration of the WebSocket endpoint is similar to the HTTP transport. To
|
||||
enable WebSocket access, use `--ws` flag. The default WebSocket port is 8546.
|
||||
The `--wsaddr`, `--wsport` and `--wsapi` flags can be used to customize settings
|
||||
The `--ws.addr`, `--ws.port` and `--ws.api` flags can be used to customize settings
|
||||
for the WebSocket server.
|
||||
|
||||
geth --ws --wsport 3334 --wsapi eth,net,web3
|
||||
geth --ws --ws.port 3334 --ws.api eth,net,web3
|
||||
|
||||
Cross-Origin request protection also applies to the WebSocket server. Use the
|
||||
`--wsorigins` flag to allow access to the server from web pages:
|
||||
`--ws.origins` flag to allow access to the server from web pages:
|
||||
|
||||
geth --ws --wsorigins http://myapp.example.com
|
||||
geth --ws --ws.origins http://myapp.example.com
|
||||
|
||||
As with `--rpccorsdomain`, using `--wsorigins '*'` allows access from any origin.
|
||||
As with `--http.corsdomain`, using `--ws.origins '*'` allows access from any origin.
|
||||
|
||||
### IPC Server
|
||||
|
||||
|
|
Loading…
Reference in New Issue