Skip to content

Commit 6a3b391

Browse files
committed
Remove leading space in "Host: ..." headers for curl and HTTP
`curl` doesn't mind but `http` fails with: http: error: InvalidHeader: Invalid return character or leading space in header: Host Removed spaces in both for consistency.
1 parent 27b36f5 commit 6a3b391

9 files changed

Lines changed: 12 additions & 13 deletions

File tree

02-basics/bin/call.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
INGRESSGATEWAY=istio-ingressgateway
44
IP_ADDRESS="$(minishift ip):$(kubectl get svc $INGRESSGATEWAY --namespace istio-system --output 'jsonpath={.spec.ports[?(@.port==80)].nodePort}')"
55

6-
curl -H "Host: greeter.knativetutorial.example.com" $IP_ADDRESS
6+
curl -H "Host:greeter.knativetutorial.example.com" $IP_ADDRESS

03-configs-and-routes/bin/call.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ IP_ADDRESS="$(minishift ip):$(kubectl get svc $INGRESSGATEWAY --namespace istio-
77

88
while true
99
do
10-
curl -H "Host: greeter.knativetutorial.example.com" $IP_ADDRESS
10+
curl -H "Host:greeter.knativetutorial.example.com" $IP_ADDRESS
1111
echo ""
1212
sleep .2
1313
done;

documentation/modules/ROOT/pages/02-basic-fundas.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ include::partial$knative-objects.adoc[tag=knative-configs]
102102
=== routes
103103
include::partial$knative-objects.adoc[tag=knative-routes]
104104

105-
When the service was invoked with `curl -H "Host: greeter.knativetutorial.example.com" $IP_ADDRESS`,you noticed that we added a **Host** header to the request with value `greeter.knativetutorial.example.com`,this FQDN is automatically assigned to your Knative service by the Knative Routes,it uses the format like `**<service-name>.<namespace>.<domain-suffix>**`.
105+
When the service was invoked with `curl -H "Host:greeter.knativetutorial.example.com" $IP_ADDRESS`,you noticed that we added a **Host** header to the request with value `greeter.knativetutorial.example.com`,this FQDN is automatically assigned to your Knative service by the Knative Routes,it uses the format like `**<service-name>.<namespace>.<domain-suffix>**`.
106106

107107
[NOTE]
108108
====

documentation/modules/ROOT/pages/03-configs-and-routes.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ include::partial$knative-objects.adoc[tag=knative-configs]
134134
=== routes
135135
include::partial$knative-objects.adoc[tag=knative-routes]
136136

137-
When the service is invoked with `curl -H "Host: greeter.knativetutorial.example.com" $IP_ADDRESS`, you noticed that we added a **Host** header to the `curl` command with the value `greeter.knativetutorial.example.com`. This FQDN is automatically assigned to your Knative service by the Knative route we created. It follows a format `<route-name>.<namespace>.<domain-suffix>`.
137+
When the service is invoked with `curl -H "Host:greeter.knativetutorial.example.com" $IP_ADDRESS`, you noticed that we added a **Host** header to the `curl` command with the value `greeter.knativetutorial.example.com`. This FQDN is automatically assigned to your Knative service by the Knative route we created. It follows a format `<route-name>.<namespace>.<domain-suffix>`.
138138

139139
[NOTE]
140140
====

documentation/modules/ROOT/pages/04-scaling.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ We will now send some load to the greeter service. The command below sends 50 c
356356
[source,bash,subs="+macros,+attributes",linenums]
357357
----
358358
siege -r 1 -c 50 -t 30S \
359-
-H "Host: greeter.knativetutorial.example.com" \
359+
-H "Host:greeter.knativetutorial.example.com" \
360360
"http://pass:[${IP_ADDRESS}]"
361361
----
362362

documentation/modules/ROOT/pages/05-build/build-templates.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ include::ROOT:partial$invoke-service.adoc[tag=env]
209209

210210
[source,bash,subs="+macros,+attributes",linenums]
211211
----
212-
curl -H "Host: event-greeter.knativetutorial.example.com" $IP_ADDRESS \
212+
curl -H "Host:event-greeter.knativetutorial.example.com" $IP_ADDRESS \
213213
-H "Content-Type: application/json" \
214214
-d '{"message": "test message"}'
215215
----
@@ -219,7 +219,7 @@ curl -H "Host: event-greeter.knativetutorial.example.com" $IP_ADDRESS \
219219
[source,bash,subs="+macros,+attributes",linenums]
220220
----
221221
http POST $IP_ADDRESS \
222-
'Host: event-greeter.knativetutorial.example.com' \
222+
'Host:event-greeter.knativetutorial.example.com' \
223223
message="test message"
224224
----
225225

documentation/modules/ROOT/pages/05-build/build.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ include::ROOT:partial$invoke-service.adoc[tag=env]
306306

307307
[source,bash,subs="+macros,+attributes",linenums]
308308
----
309-
curl -H "Host: event-greeter.knativetutorial.example.com" $IP_ADDRESS \
309+
curl -H "Host:event-greeter.knativetutorial.example.com" $IP_ADDRESS \
310310
-H "Content-Type: application/json" \
311311
-d '{"message": "test message"}'
312312
----
@@ -316,7 +316,7 @@ curl -H "Host: event-greeter.knativetutorial.example.com" $IP_ADDRESS \
316316
[source,bash,subs="+macros,+attributes",linenums]
317317
----
318318
http POST $IP_ADDRESS \
319-
'Host: event-greeter.knativetutorial.example.com' \
319+
'Host:event-greeter.knativetutorial.example.com' \
320320
message="test message"
321321
----
322322

documentation/modules/ROOT/pages/_partials/invoke-service.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ IP_ADDRESS="$({k8s-env} ip):$({k8s-cli} get svc $INGRESSGATEWAY --namespace isti
1111
#tag::call[]
1212
[source,bash,subs="+macros,+attributes"]
1313
----
14-
curl -v -H "Host: greeter.knativetutorial.example.com" $IP_ADDRESS
14+
curl -v -H "Host:greeter.knativetutorial.example.com" $IP_ADDRESS
1515
----
1616

1717
.(OR)
1818

1919
[source,bash,subs="+macros,+attributes"]
2020
----
21-
http $IP_ADDRESS 'Host: greeter.knativetutorial.example.com'
21+
http $IP_ADDRESS 'Host:greeter.knativetutorial.example.com'
2222
----
2323
#end::call[]

documentation/modules/ROOT/pages/faq.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ if kubectl get configmap config-istio -n knative-serving &> /dev/null; then
1717
INGRESSGATEWAY=istio-ingressgateway
1818
fi
1919

20-
INGRESSGATEWAY=istio-ingressgateway
2120
IP_ADDRESS="$(minishift ip):$(kubectl get svc $INGRESSGATEWAY --namespace istio-system --output 'jsonpath={.spec.ports[?(@.port==80)].nodePort}')"
2221

2322
# calling a knative service named greeter
24-
curl -H "Host: greeter.knativetutorial.example.com" $IP_ADDRESS
23+
curl -H "Host:greeter.knativetutorial.example.com" $IP_ADDRESS
2524
----
2625

2726
[#faq-q2]

0 commit comments

Comments
 (0)