esi-test-server-docker icon indicating copy to clipboard operation
esi-test-server-docker copied to clipboard

ESI: Invalid method encountered

Open dipak7587 opened this issue 2 years ago • 3 comments

I am using the playground for resolving ESI fragmentation.
` <esi:include src="http://10.35.249.181:5012/esi/fragment.html" ttl="230" maxwait="1000"/>

`

Output: ` <SPAN class="hide"> /Debugging Section/

[2034]: Source encoding detected: UTF-8. GEO: georegion=246,country_code=US,region_code=CA,city=SANJOSE,dma=807,pmsa=7400,areacode=408,county=SANTACLARA,fips=06085,lat=37.3353,long=-121.8938,timezone=PST,network_type=dialup HTTP_ACCEPT: HTTP_ACCEPT_CHARSET: HTTP_ACCEPT_ENCODING: HTTP_ACCEPT_LANGUAGE: HTTP_CONTENT_LENGTH: 306 HTTP_CONTENT_LOCATION: HTTP_CONTENT_TYPE: text/html; charset=utf-8 HTTP_COOKIE: HTTP_HOST: debug.playground.ets HTTP_REFERER: HTTP_USER_AGENT: QUERY_STRING: REMOTE_ADDR: 127.0.0.1 REQUEST_METHOD: GET REQUEST_PATH: /58f2f1f7cae405374f75bfd6c0ca823f HTTP_DATE: Mon, 16 Jan 2023 12:34:45 GMT HTTP_CONNECTION: close HTTP_X_POWERED_BY: Express HTTP_ETAG: W/"132-SLdxAKAFWKtoTJkqbTN+e04VG9I" [2007]: Line 2. Including fragment "http://10.35.249.181:5012/esi/fragment.html". Warning: [2006]: Line 2. Failed fetching fragment "http://10.35.249.181:5012/esi/fragment.html". Error: [2005]: Your code did not run successfully. /********************End Debugging Section*****************/ `

I checked the backend server, it's giving Error: Parse Error: Invalid method encountered error I tried many things but I could not resolve this issues please suggest what I am doing wrong

Backend error: `[Error: Parse Error: Invalid method encountered] { bytesParsed: 267, code: 'HPE_INVALID_METHOD', reason: 'Invalid method encountered', rawPacket: <Buffer 47 45 54 20 2f 65 73 69 65 73 69 2f 65 6e 67 6c 69 73 68 2f 70 65 70 2f 67 2d 6f 2d 63 2d 30 30 38 2d 34 2d 70 61 67 65 2d 68 65 61 64 65 72 2e 68 74 ... 389 more bytes>, headerSent: true } GET /esi/Fragment.html HTTP/1.1 Accept: / Host: 10.35.249.181:5012

Via: 4.0 asi_server

X-Akamai-ClientIP: 127.0.0.1

X-Akamai-MD-Component3: cache:max-age230s</cache:max-age>

X-AKAMAI-FORCE-G2G-AUTH: On

Connection: close

`

Docker command : docker run -ti -p 8088:80 akamaiesi/ets-docker:latest --remote_origin http://10.35.249.181:5012 --debug 10.35.249.181 --geo 10.35.249.181:off --remote_origin 127.0.0.1:5012 --debug localhost --geo localhost:off

dipak7587 avatar Jan 16 '23 12:01 dipak7587

I've noticed two "--remote_origin" options/flags at your command, one of them is incorrect: --remote_origin http://10.35.249.181:5012/

the flag should look like: --remote_origin hostname:port - hostname and port to use for an additional remote/upstream origin

sjoulano avatar Jan 16 '23 16:01 sjoulano

Hi @sjoulano ,

I am testing in the local system and I corrected the docker command but its not working docker run -ti -p 8088:80 akamaiesi/ets-docker:latest --remote_origin 10.35.249.181:5012 --debug 10.35.249.181 --geo 10.35.249.181:off --debug localhost --geo localhost:off

10.35.249.181 : local system IP

Server Error: [Error: Parse Error: Invalid method encountered] { bytesParsed: 71, code: 'HPE_INVALID_METHOD', reason: 'Invalid method encountered', rawPacket: <Buffer 47 45 54 20 2f 66 72 61 6d 67 6d 65 6e 74 2e 68 74 6d 6c 20 48 54 54 50 2f 31 2e 31 0d 0a 41 63 63 65 70 74 3a 20 2a 2f 2a 0d 0a 48 6f 73 74 3a 20 31 ... 431 more bytes>, headerSent: true } GET /framgment.html HTTP/1.1 Accept: / Host: 10.35.249.181:5012

Via: 4.0 asi_server

X-Akamai-ClientIP: 127.0.0.1

Cookie: Akamai-UnencDebug=Akamai-ClientIP=127.0.0.1;Akamai-CPDomain=.0.0.1;Akamai-DebugValue=On;Akamai-Expires=999999999

X-Akamai-MD-Component3: cache:max-age230s</cache:max-age>

X-AKAMAI-FORCE-G2G-AUTH: On

X-Akamai-Debug: Akamai-ClientIP=127.0.0.1;Akamai-CPDomain=.0.0.1;Akamai-DebugValue=On;Akamai-Expires=999999999

Connection: close

Analyze:

  1. Akamai ETS is giving some request headers, between the request headers extra spaces are there, and the server lot is able to parse the request headers.
  2. I put the console log for request headers, it is showing only two headers Accept: / Host: 10.35.249.181:5012
  3. In the above error message is showing bytesParsed error in line number 71 and I am checking what is the data in line number 71 then its showing space (" ").

dipak7587 avatar Jan 17 '23 04:01 dipak7587

Maybe it is related to the encoding? E.g. bytes to string conversion on your server.

sjoulano avatar Jan 17 '23 15:01 sjoulano