"invalid host header" 启动 Hyperledger 开发人员指南教程的骨架 Web 应用程序
"invalid host header" starting Skeleton Web Application for Hyperledger Developer Guide tutorial
我正在检查 Hyperledger Developer Guide Tutorial。我已经通过 Generate REST API 完成了这些步骤,没有任何问题。在完成 Generate your Skeleton Web Application 部分后,我在 shell 输出中没有看到任何问题,但是当我尝试按照指示导航到端口 4200 时,我得到一个几乎空白的屏幕,显示 Invalid Host header
.
在 Rocketchat 的#composer 频道中,我看到有人有 similar problem。有人建议这是:
because the directory specified in your hlfv1 profile under
keyValStore cannot be created or accessed. Most likely you have
specified a directory such as /home/fred/.hfc-key-store but the user
fred doesn't exist so the directory /home/fred doesn't exist. One
solution would be just to create the directory path yourself.
我检查了一下,我的目录没问题:
ibmadmin@pfuntner1:~/repos$ cat /home/ibmadmin/.composer-connection-profiles/hlfv1/connection.json
{
"type": "hlfv1",
"orderers": [
{ "url" : "grpc://localhost:7050" }
],
"ca": { "url": "http://localhost:7054",
"name": "ca.org1.example.com"
},
"peers": [
{
"requestURL": "grpc://localhost:7051",
"eventURL": "grpc://localhost:7053"
}
],
"keyValStore": "/home/ibmadmin/.composer-credentials",
"channel": "composerchannel",
"mspID": "Org1MSP",
"timeout": "300"
}
ibmadmin@pfuntner1:~/repos$ ls -ld /home/ibmadmin/.composer-credentials
drwxrwxr-x 2 ibmadmin ibmadmin 4096 Sep 13 15:11 /home/ibmadmin/.composer-credentials
ibmadmin@pfuntner1:~/repos$ ls -l /home/ibmadmin/.composer-credentials
total 24
-rw-r--r-- 1 ibmadmin ibmadmin 246 Sep 13 15:10 114aab0e76bf0c78308f89efc4b8c9423e31568da0c340ca187a9b17aa9a4457-priv
-rw-r--r-- 1 ibmadmin ibmadmin 182 Sep 13 15:11 114aab0e76bf0c78308f89efc4b8c9423e31568da0c340ca187a9b17aa9a4457-pub
-rw-rw-r-- 1 ibmadmin ibmadmin 246 Sep 13 15:11 2a176af765281bb00394c2427cb7acc679d3eb9b504703eaba8c32a5a0f1a61c-priv
-rw-rw-r-- 1 ibmadmin ibmadmin 182 Sep 13 15:40 2a176af765281bb00394c2427cb7acc679d3eb9b504703eaba8c32a5a0f1a61c-pub
-rw-rw-r-- 1 ibmadmin ibmadmin 962 Sep 13 15:40 admin
-rw-r--r-- 1 ibmadmin ibmadmin 1024 Sep 13 15:11 PeerAdmin
ibmadmin@pfuntner1:~/repos$
有人有什么建议吗?
更新
我添加了这条语句:
$ diff -C5 node_modules/@angular/cli/tasks/serve.js.orig node_modules/@angular/cli/tasks/serve.js
*** node_modules/@angular/cli/tasks/serve.js.orig 2017-09-14 12:20:45.462357278 -0400
--- node_modules/@angular/cli/tasks/serve.js 2017-09-14 11:27:55.682265096 -0400
***************
*** 158,167 ****
--- 158,168 ----
ui.writeLine(chalk.green(common_tags_1.oneLine `
**
NG Live Development Server is running on ${serverAddress}
**
`));
+ webpackDevServerConfiguration.disableHostCheck = true;
const server = new WebpackDevServer(webpackCompiler, webpackDevServerConfiguration);
return new Promise((_resolve, reject) => {
server.listen(serveTaskOptions.port, serveTaskOptions.host, (err, _stats) => {
if (err) {
return reject(err);
$
这似乎是webpack相关的,虽然我自己没有看到这个问题。
通过用我的实际 IP 地址替换 package.json 中的 0.0.0.0 主机参数,我能够解决这个问题。它位于 package.json 文件的脚本部分:
"scripts": {
"ng": "ng",
"build": "ng build",
"prepack": "npm run build",
"start": "ng serve --proxy-config proxy.conf.js --host 0.0.0.0",
...
更改此设置后 运行 "npm start",可以从远程主机访问端口 4200。
我正在检查 Hyperledger Developer Guide Tutorial。我已经通过 Generate REST API 完成了这些步骤,没有任何问题。在完成 Generate your Skeleton Web Application 部分后,我在 shell 输出中没有看到任何问题,但是当我尝试按照指示导航到端口 4200 时,我得到一个几乎空白的屏幕,显示 Invalid Host header
.
在 Rocketchat 的#composer 频道中,我看到有人有 similar problem。有人建议这是:
because the directory specified in your hlfv1 profile under keyValStore cannot be created or accessed. Most likely you have specified a directory such as /home/fred/.hfc-key-store but the user fred doesn't exist so the directory /home/fred doesn't exist. One solution would be just to create the directory path yourself.
我检查了一下,我的目录没问题:
ibmadmin@pfuntner1:~/repos$ cat /home/ibmadmin/.composer-connection-profiles/hlfv1/connection.json
{
"type": "hlfv1",
"orderers": [
{ "url" : "grpc://localhost:7050" }
],
"ca": { "url": "http://localhost:7054",
"name": "ca.org1.example.com"
},
"peers": [
{
"requestURL": "grpc://localhost:7051",
"eventURL": "grpc://localhost:7053"
}
],
"keyValStore": "/home/ibmadmin/.composer-credentials",
"channel": "composerchannel",
"mspID": "Org1MSP",
"timeout": "300"
}
ibmadmin@pfuntner1:~/repos$ ls -ld /home/ibmadmin/.composer-credentials
drwxrwxr-x 2 ibmadmin ibmadmin 4096 Sep 13 15:11 /home/ibmadmin/.composer-credentials
ibmadmin@pfuntner1:~/repos$ ls -l /home/ibmadmin/.composer-credentials
total 24
-rw-r--r-- 1 ibmadmin ibmadmin 246 Sep 13 15:10 114aab0e76bf0c78308f89efc4b8c9423e31568da0c340ca187a9b17aa9a4457-priv
-rw-r--r-- 1 ibmadmin ibmadmin 182 Sep 13 15:11 114aab0e76bf0c78308f89efc4b8c9423e31568da0c340ca187a9b17aa9a4457-pub
-rw-rw-r-- 1 ibmadmin ibmadmin 246 Sep 13 15:11 2a176af765281bb00394c2427cb7acc679d3eb9b504703eaba8c32a5a0f1a61c-priv
-rw-rw-r-- 1 ibmadmin ibmadmin 182 Sep 13 15:40 2a176af765281bb00394c2427cb7acc679d3eb9b504703eaba8c32a5a0f1a61c-pub
-rw-rw-r-- 1 ibmadmin ibmadmin 962 Sep 13 15:40 admin
-rw-r--r-- 1 ibmadmin ibmadmin 1024 Sep 13 15:11 PeerAdmin
ibmadmin@pfuntner1:~/repos$
有人有什么建议吗?
更新
我添加了这条语句:
$ diff -C5 node_modules/@angular/cli/tasks/serve.js.orig node_modules/@angular/cli/tasks/serve.js
*** node_modules/@angular/cli/tasks/serve.js.orig 2017-09-14 12:20:45.462357278 -0400
--- node_modules/@angular/cli/tasks/serve.js 2017-09-14 11:27:55.682265096 -0400
***************
*** 158,167 ****
--- 158,168 ----
ui.writeLine(chalk.green(common_tags_1.oneLine `
**
NG Live Development Server is running on ${serverAddress}
**
`));
+ webpackDevServerConfiguration.disableHostCheck = true;
const server = new WebpackDevServer(webpackCompiler, webpackDevServerConfiguration);
return new Promise((_resolve, reject) => {
server.listen(serveTaskOptions.port, serveTaskOptions.host, (err, _stats) => {
if (err) {
return reject(err);
$
这似乎是webpack相关的,虽然我自己没有看到这个问题。
通过用我的实际 IP 地址替换 package.json 中的 0.0.0.0 主机参数,我能够解决这个问题。它位于 package.json 文件的脚本部分:
"scripts": {
"ng": "ng",
"build": "ng build",
"prepack": "npm run build",
"start": "ng serve --proxy-config proxy.conf.js --host 0.0.0.0",
...
更改此设置后 运行 "npm start",可以从远程主机访问端口 4200。