Closed wwerner closed 4 years ago
This works on the most recent version of Docker for Mac for the latest commit hash on the master branch. There is however a hanging issue with the content length header that is a valid issue for http://localhost:8080/app
or any 301 redirects being served for rewriting a URL. I think @wwerner fixed that, so we should push that fix to master.
One thing I did differently here was to make sure I installed the latest Vlingo platform core libraries using mvn clean install
on vlingo-common
vlingo-actors
vlingo-wire
and vlingo-http
with the latest commit hash on those projects.
Let's make a mental note about static resource issues in the future with vlingo http. But for now let's close this issue. Thanks!
@kbastani I walked the code multiple times last week in search of how a Content-Length
header is not being created. Literally when a Response
is instantiated the body is checked for content and existing headers are checked for content length and added if missing. I don't see a code path where that doesn't happen. Can you pinpoint where this bypass occurs?
Try schemata and remove the content length header from the UI resource code that performs a 301 redirect. This is definitely an open issue.
On Fri, Dec 6, 2019 at 5:40 PM Vaughn Vernon notifications@github.com wrote:
@kbastani https://github.com/kbastani I walked the code multiple times last week in search of how a Content-Length header is not being created. Literally when a Response is instantiated the body is checked for content and existing headers are checked for content length and added if missing. I don't see a code path where that doesn't happen. Can you pinpoint where this bypass occurs?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vlingo/vlingo-schemata/issues/102?email_source=notifications&email_token=AAP7VGVK7I4XOEMZQLDYY4TQXLIFRA5CNFSM4JW736D2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGFSAKQ#issuecomment-562765866, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAP7VGQJVRNKBGRSIOVMG7DQXLIFRANCNFSM4JW736DQ .
@kbastani I see the Content-Length
header here:
The 301 Moved Permanently
does not contain content and currently doesn't set a Content-Length
header:
Can you clarify which of these will be problematic when a Content-Length
header is missing in the Response
?
private Completes<Response> redirectToApp(String path) {
return Completes.withSuccess(
Response.of(MovedPermanently, Header.Headers.of(
ResponseHeader.of("Location", path)), ""));
}
The above does not work.
private Completes<Response> redirectToApp(String path) {
return Completes.withSuccess(
Response.of(MovedPermanently, Header.Headers.of(
ResponseHeader.of("Location", path),
ResponseHeader.of(ContentLength, 0)), ""));
}
The above works.
@wwerner @kbastani I have written three tests. There are two in vlingo-http that test the general feature of a response sans Content-Length
header, and one in vlingo-schemata that tests the specific case of MovedPermanently
. All three tests pass.
UserResource
ServerTest#testThatServerRespondsPermanentRedirectWithNoContentLengthHeader
ServerTest#testThatServerRespondsOkWithNoContentLengthHeader
Currently, the app hangs when serving resources, but only when run within docker. Running the jar works as expected.
Steps to reproduce
mvn package
(⚠️ use JDK 1.8)java -jar target/vlingo-schemata-0.9.3-RC4-jar-with-dependencies.jar dev
curl localhost:9019/app/
-> This works as expecteddocker build . -t vlingo/vlingo-schemata
docker run -p9019:9019 vlingo/vlingo-schemata
curl localhost:9019/app/
-> The request hangs@kbastani wrote an alternative implementation for serving static resources (https://github.com/vlingo/vlingo-xoom/blob/master/vlingo-xoom-server/src/main/java/io/vlingo/xoom/resource/CachedStaticFilesResource.java) using caches instead of re-reading resources from the FS that seems not to suffer from this issue.