Re: HTTP request status text is changed


Ben Hale <bhale@...>
 

As I mentioned earlier, the difference in behavior is down to the command that is being run when the application is pushed to Cloud Foundry. When you push your WAR to CloudFoundry, it is being run in a Tomcat container that is not configured to allow custom status messages. If you want to run the application in its embedded Jetty container, you’ll need to ensure that it has a `Main-Class` entry in the JAR’s manifest that will start the embedded Jetty container.


-Ben Hale
Cloud Foundry Java Experience

On May 11, 2016, at 12:45 AM, Stanley Shen <meteorping(a)gmail.com> wrote:

I created the docker image, and you can find it "meteorping2/hello".

You can push the image as an APP like "cf push stanley -o meteorping2/hello"
When the APP is ready, you can access the servlet like:
wget http://stanley.test.io/hello

And I got result
=======================================
:~ stanleyshen$ wget http://stanley.test.io/hello
--2016-05-11 15:23:16-- http://stanley.test.io/hello
Resolving stanley.test.io... 11.22.33.44
Connecting to stanley.test.io|11.22.33.44|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2016-05-11 15:23:17 ERROR 403: Forbidden.
=======================================

But if you access the servlet deployed in local env via "java -jar jetty-runner.jar testId.war" you will get below result:
=======================================
--2016-05-11 07:04:31-- http://127.0.0.1:8080/hello
Connecting to 127.0.0.1:8080... connected.
HTTP request sent, awaiting response... 403 my customized 413 error message
2016-05-11 07:04:31 ERROR 403: my customized 413 error message.
=======================================

And here is the Dockerfile definition:
=======================================
FROM java:8
COPY . /usr/src/myapp
WORKDIR /usr/src/myapp

CMD java -jar jetty-runner.jar testId.war
=======================================
Thanks for investigation, let me know if you still cannot reproduce the issue.

Regards,
Stanley

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.