Header Process instance id contains invalid character

Hi,

I am getting below error when I receive the response. Is this because of some header in the response? I am not able to see which header is causing this in trace. Can you please help?

{ "fault": { "faultstring": "Header Process instance id contains invalid character ", "detail": { "errorcode": "protocol.http.HeaderWithInvalidChar" } } }

0 4 2,076
4 REPLIES 4

Hi,

Adding onto this, I just tried tests and it seems like it's failing because of the header "Error code" because of the space. How do we handle this at APIGEE?

Thanks

Can you SHOW the response that is being sent back to Apigee Edge?

I think the names of HTTP Headers should not have spaces. Reading RFC2616 section 4.2, it gives:

       message-header = field-name ":" [ field-value ]
       field-name     = token
       field-value    = *( field-content | LWS )
       field-content  = <the OCTETs making up the field-value
                        and consisting of either *TEXT or combinations
                        of token, separators, and quoted-string><br>

and section 2.2 specifies the token:

       token          = 1*<any CHAR except CTLs or separators>
       separators     = "(" | ")" | "<" | ">" | "@"
                      | "," | ";" | ":" | "\" | <">
                      | "/" | "[" | "]" | "?" | "="
                      | "{" | "}" | SP | HT

In English, that means a header-name must not contain spaces or any of those other separator characters.

RFC 2616 has been superceded by RFC 7230, but those requirements remain the same.

If I understand your situation correctly, Apigee Edge is throwing an error when the backend (target) system does not comply with the HTTP Specification in this regard. You suggested it was the "Error code" header but the error message from Apigee Edge identifies a header named "Process instance id". Whichever the header, throwing a fault when a header name contains a space seems like correct behavior by Apigee Edge. What are you expecting Apigee Edge to do?

@Dino-at-Google Thanks for your response,

Apigee did not log the response or the header in trace. However, I tried using some other gateway and was able to see the below headers.

So re-created that headers using the stub internally at APIGEE and found out it's failing because of the space. Both the gateways are receiving the same headers and failing the response.

Strange thing is, when I try the same back end directly using POSTMAN, I don't see these headers(with space) and get back the JSON response. Any explanation for this? Back end team is unable to address the issue.

HTTP/1.1 200 OK

Date: Tue, 09 Jul 2019 09:48:35 GMT
Content-length: 224
Content-type: application/json;charset=UTF-16
User-agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
_charset: UTF-16
Process instance id: 2-1BK7GFEN
Connection: keep-alive
Accept: */*
Accept-language: en-GB,en-US;q=0.9,en;q=0.8
Datahandlingsubsystem: RESTInput
Transporttype: HTTP
Postman-token: fa0a6429-e1aa-df57-c963-157bdf32500c
Responsecode: 0001
X-correlationid: Id-e262245d00bc17aa1808fb03 1
Via: 1.1 blt06717021 ()
Cache-control: no-cache, must-revalidate, max-age=0
Max-forwards: 20
Pragma: no-cache
Error code: 1520
Expect: 100-continue
Error message: It is not possible to Amend the order as your order is Cancelled

Hi @Shivakumar Sudi

APIGEE logs all headers and response in the trace. you can see the attachments for the reference. screen-shot-2019-07-10-at-50853-pm.png

screen-shot-2019-07-10-at-50908-pm.png

However, you don't see this the headers in the trace because your request is not going to apigee at all. Error you have attached is the validate request which happens before your api call goes to the apigee.

I have tried with POSTMAN and CURL and both validates and won't allow you to send the request if the header doesn't meet standards.

curl -X GET \                                                                                                                              ✔  1744  17:06:54
  http://XXXXXXXXXXX-eval-test.apigee.net/testproxy/get \
  -H 'Accept: */*' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Error code: 202020' \
  -H 'Host: XXXXXXXXXX-eval-test.apigee.net' \
  -H 'Postman-Token: 87a775fa-ed26-4d8d-98b6-eb94d1b4750b,a473df0e-5c5a-43a8-8852-4feab196b5c4' \
  -H 'User-Agent: PostmanRuntime/7.13.0' \
  -H 'accept-encoding: gzip, deflate' \
  -H 'cache-control: no-cache'
{"fault":{"faultstring":"Header Error code contains invalid character  ","detail":{"errorcode":"protocol.http.HeaderWithInvalidChar"}}}%




I hope this clarifies you.