akamai / esi-test-server-docker

A dockerized version of Akamai's Edge Side Includes Test Server (ETS).
32 stars 6 forks source link

Remote origin does not load #12

Closed asoules closed 5 years ago

asoules commented 5 years ago

The Docker Compose example provided here: https://github.com/akamai/esi-test-server-docker/tree/master/dockerimage-tests/test/gzip does not appear to proxy the remote origin. The networking setup checks out, the nginx-gzip host is reachable from the ets container, and the logs suggest that origin is configured correctly. But when you load localhost:{ETS_PORT} you just get a static page served by Apache.

I followed the documentation and ran into exactly the same problem in my own project, it's as if the remote origin functionality is disabled.

tdickers commented 5 years ago

Hi, would you mind providing a sample HTTP request (e.g. curl -v output) and your docker-compose.yml (if comfortable with that), please?

Is the issue specifically with trying to get an example based off of this working, or are you unable to get any remote origin working?

asoules commented 5 years ago

docker-compose.yml

The only change I made was binding port 80 in the container to 8282 on the host.

version: '2' # older version for broader compat
services:
  ets:
    image: "akamaiesi/ets-docker:latest"
    environment:
      - ETS_CLI_ARGS=--remote_origin origin --debug origin
    links:
      - origin
    ports:
      - 8282:80
  origin:
    build: nginx-gzip
    image: "nginx-gzip"
    volumes:
      - .:/usr/share/nginx/html

Logs:

a10s-3:gzip asoules$ docker-compose up -d
Creating network "gzip_default" with the default driver
Creating gzip_origin_1 ... done
Creating gzip_ets_1    ... done
a10s-3:gzip asoules$ docker-compose logs -f
Attaching to gzip_ets_1, gzip_origin_1
ets_1     |     ___    __                         _    _________________
ets_1     |    /   |  / /______ _____ ___  ____ _(_)  / ____/_  __/ ___/
ets_1     |   / /| | / //_/ __ `/ __ `__ \/ __ `/ /  / __/   / /  \__ \
ets_1     |  / ___ |/ ,< / /_/ / / / / / / /_/ / /  / /___  / /  ___/ /
ets_1     | /_/  |_/_/|_|\__,_/_/ /_/ /_/\__,_/_/  /_____/ /_/  /____/
ets_1     |
ets_1     | For usage information, run $ docker run -ti akamaiesi/ets-docker -h
ets_1     |
ets_1     | ESI and Sandbox settings:
ets_1     |     Hostname:        localhost
ets_1     |     ESI port:        80
ets_1     |     Playground path: /playground
ets_1     |     Sandbox path:    /sandbox (ESI off; default ESI origin)
ets_1     |     ESI debugging:   off
ets_1     |     GEO/Edgescape:   on
ets_1     |       georegion    = 246
ets_1     |       country_code = US
ets_1     |       region_code  = CA
ets_1     |       city         = SANJOSE
ets_1     |       dma          = 807
ets_1     |       pmsa         = 7400
ets_1     |       areacode     = 408
ets_1     |       county       = SANTACLARA
ets_1     |       fips         = 06085
ets_1     |       lat          = 37.3353
ets_1     |       long         = -121.8938
ets_1     |       timezone     = PST
ets_1     |       network_type = dialup
ets_1     |
ets_1     | Remote origin origin settings:
ets_1     |     Hostname:        origin
ets_1     |     Upstream port:   80
ets_1     |     ESI debugging:   on
ets_1     |     GEO/Edgescape:   on
ets_1     |       georegion    = 246
ets_1     |       country_code = US
ets_1     |       region_code  = CA
ets_1     |       city         = SANJOSE
ets_1     |       dma          = 807
ets_1     |       pmsa         = 7400
ets_1     |       areacode     = 408
ets_1     |       county       = SANTACLARA
ets_1     |       fips         = 06085
ets_1     |       lat          = 37.3353
ets_1     |       long         = -121.8938
ets_1     |       timezone     = PST
ets_1     |       network_type = dialup
ets_1     |

Curl Output:

a10s:~ asoules$ curl -v http://localhost:8282
* Rebuilt URL to: http://localhost:8282/
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8282 (#0)
> GET / HTTP/1.1
> Host: localhost:8282
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 02 May 2019 13:20:26 GMT
< Server: Apache/2.4.25 (Unix) OpenSSL/1.0.1
< Last-Modified: Thu, 02 May 2019 13:20:26 GMT
< Content-Length: 1143
< Content-Type: text/html
< Edge-Control: downstream-ttl=0
< X-Akamai-ASIS-Flitload: 0
< ETag: "47c-5705c19943a00"
< Accept-Ranges: bytes
<
<html>
    <head>
        <meta http-equiv="content-type" content="text/html;charset=utf-8" />
        <title>ESI Test Server 6.0.0.9
 | Akamai</title>
        <link href="/style.css" rel="stylesheet">
    </head>
    <body>
        <div class="page">
            <div class="content">
                <div class="header">
                    <a class="akamai" href="http://www.akamai.com"><span>Akamai</span></a>
                </div>
                <div class="body">
                    <h1>ESI Test Server 6.0.0.9
</h1>
                </div>
                <h2></h2>
                <h2>Welcome</h2>
                <p>
                Welcome to the ESI Test Server (ETS). ETS allows you
                to view and test content that has been accelerated using Edge Side Includes (ESI).
                </p>
                <p><b>
                <p>If you see this text, inclusions via ESI from localhost are working.</p>
                </b></p>
                <ul>
                    <li><a href="release_notes.txt">Release Notes</a></li>
                    <li><a href="esi-examples/index.html">ESI Usage Examples</a></li>
                    <li><a href="/playground">ESI Playground</a> - real time, test-as-you-type ESI testing tool</li>
                    <li><a href="/server-status">Apache server status</a></li>
                </ul>
            </div>
            <div class="footer">&copy; 2018 Akamai Technologies</div>
        </div>
    </body>
</html>

* Connection #0 to host localhost left intact

I have tried pretty much every configuration option listed in the README, and have not been able to use ETS in reverse proxy mode with a remote origin.

tdickers commented 5 years ago

It looks like you're missing a Host header in your curl.

The following works for me with your changed compose file:

curl -v -H Host:origin localhost:8282/gzip.html | grep success
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8282 (#0)
> GET /gzip.html HTTP/1.1
> Host:origin
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Tue, 07 May 2019 02:55:59 GMT
< Server: nginx/1.15.12
< Last-Modified: Tue, 07 May 2019 02:55:59 GMT
< Content-Length: 2386
< Content-Type: text/html
< Edge-Control: downstream-ttl=0
< X-Akamai-ASIS-Flitload: 0
< ETag: "5cd0ed89-299"
< Accept-Ranges: bytes
<
{ [2386 bytes data]
100  2386  100  2386    0     0   164k      0 --:--:-- --:--:-- --:--:--  166k
* Connection #0 to host localhost left intact
[2004]: Your code ran successfully.
tdickers commented 5 years ago

Here's an example using a remote server:

$ docker run -d -p 8282:80 akamaiesi/ets-docker:latest --remote_origin esi-examples.akamai.com
$ curl -H Host:esi-examples.akamai.com localhost:8282/today.html
<html>
<body>

Today is Tuesday May 07, 2019<br>

    <p>

        <a href="/viewsource/today.html">[View ESI Source]</a><br>

    (You may have to view the page source to view the ESI code after clicking on the link)
    <p>

        <a href="index.html">Example Home Page</a><br>

</body>
</html>