Truffle
松露通過 HTTPS 工作
我安裝了自己的乙太坊節點並將其放在 HTTPS nginx 代理後面。
geth attach works perfectly
但truffle deploy
失敗並出現錯誤:<html> <head><title>400 The plain HTTP request was sent to HTTPS port</title> </head> <body bgcolor=\"white\"> <center><h1>400 Bad Request</h1> </center> <center>The plain HTTP request was sent to HTTPS port</center> <hr><center>nginx/1.10.2</center> </body> </html>
我明白為什麼會這樣,問題是如何強制 Truffle 通過 HTTPS 而不是 HTTP 工作?
我找到了這種情況的解決方法,只需將
provider
欄位添加到truffle.js
:const Web3 = require('web3'); module.exports = { networks: { ropsten: { ................. provider: new Web3.providers.HttpProvider('https://host.name:8545') }, rinkeby: { ...... provider: new Web3.providers.HttpProvider('https://host.name:8546') } } };