typesafehub / conductr-lib

Other
8 stars 13 forks source link

Play 2.6 Bundle Lib: append allow hosts #164

Closed fsat closed 6 years ago

fsat commented 6 years ago

Obtain the reference to existing config, and append BUNDLE_HOST_IP to the list of allowed hosts

fsat commented 6 years ago

Marked as wip - I'd like to do some actual manual test before merging.

fsat commented 6 years ago

Attempt to fix #163.

fsat commented 6 years ago

@TimMoore - whoa, that was quick 😀

I'll do the manual test myself based on the reproducer created to report this problem.

Thanks for the quick review!

fsat commented 6 years ago

Manual test is completed successfully.

Setup

Checkout the following PR branch of conductr-lib: https://github.com/typesafehub/conductr-lib/pull/164

Run the following command to publish the artefact locally:

sbt publishLocal

Download the following Play app:

allowed-hosts-issue.tar.gz

Expand to local directory, and run:

sbt run

The Play app is configured with the snapshot version of the conductr-lib which contains the fix.

Test Result

The Play app is accessible through localhost:9000. Without this fix, the AHC filter would prevent the access as the localhost:9000 configured through application.conf will be overridden as per #163.

$ curl -v localhost:9000
* Rebuilt URL to: localhost:9000/
*   Trying ::1...
* Connected to localhost (::1) port 9000 (#0)
> GET / HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 08 Dec 2017 07:57:07 GMT
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 24
<
localhost:9000
* Connection #0 to host localhost left intact
127.0.0.1192-168-1-5:conductr-bundle-lib felixsatyaputra$ curl -v localhost:9000
* Rebuilt URL to: localhost:9000/
*   Trying ::1...
* Connected to localhost (::1) port 9000 (#0)
> GET / HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 08 Dec 2017 07:57:12 GMT
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 24
<
localhost:9000
127.0.0.1