Bug 813061

Summary: DIY Application content is being overridden for 4xx status codes
Product: OKD Reporter: Ram Ranganathan <ramr>
Component: ContainersAssignee: Mrunal Patel <mpatel>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: mfisher, mmcgrath, yquan
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-08 17:58:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
status 400 python sample none

Description Ram Ranganathan 2012-04-16 18:56:11 UTC
Description of problem:
For a DIY custom application, if the application server returns a 4xx status code, then the content returned back from the application server is getting overridden. 

Version-Release number of selected component (if applicable):
diy-0.1 on production

How reproducible:
Always.

Steps to Reproduce:
1. Create a diy application  rhc app create -a diy1 -t diy-0.1 .
2. Add the attached python script to your git repo [say to diy1/diy directory] 
    and start it on deployment (either modify the .openshift/action_hooks or
    you can ssh into the instance and run the python script).
3. git commit  &&  git push
4. ssh $(rhc app show -a diy1 | grep "Git URL" | cut -f 3 -d ':' | cut -f 3 -d '/')
5. cd $OPENSHIFT_REPO_DIR/diy/  &&  python status400.py

From your client run: 
curl  -vvv  $(rhc app show -a diy1 | grep "Public URL" | cut -f 2- -d ':')
  
Actual results:
The 400 http status code is returned back but the content is overlaid by apache's default error page.

Expected results:
The 400 http status code and page content is returned back to the caller.

Additional info:

Comment 1 Ram Ranganathan 2012-04-16 18:57:19 UTC
Created attachment 577805 [details]
status 400 python sample

Comment 2 Ram Ranganathan 2012-04-16 19:00:08 UTC
The ProxyErrorOverride On directive is causing the errors to get overriden.

Bug created for forum post: https://www.redhat.com/openshift/community/forums/openshift/apache-captures-bad-requests-with-do-it-yourself-modules

Comment 3 Mike McGrath 2012-05-15 18:52:35 UTC
Lets pull this one in to this sprint.

Ram can you confirm this fix (and fix it in devenv) then work with Thomas to get it updated in int/stg/prod?

Comment 4 Mike McGrath 2012-05-15 19:11:23 UTC
oh sorry, this one's assigned to Mrunal.  So Mrunal, can you do this this sprint?  If not let me know.

Comment 5 Mrunal Patel 2012-05-30 23:28:22 UTC
Submitted pull request - https://github.com/openshift/crankcase/pull/94

Comment 6 yquan 2012-05-31 09:08:06 UTC
The new patch have not integrated to devenv_1809,So just keep on this status,I will test again when the new build come out.

Comment 7 yquan 2012-05-31 10:55:53 UTC
I tested it on devenv_1810:

step:

1.create an diy app
2.git push the status400.py to the app repo
3.stop this app #because some other progress occupied the 8080 port.
4.ssh on the app ,
5.run the script 


The curl output:


[root@localhost ~]# curl  -vvv http://diy0-domaintest0002.dev.rhcloud.com/
* About to connect() to diy0-domaintest0002.dev.rhcloud.com port 80 (#0)
*   Trying 23.22.151.234... connected
* Connected to diy0-domaintest0002.dev.rhcloud.com (23.22.151.234) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.21.7 (i386-redhat-linux-gnu) libcurl/7.21.7 NSS/3.13.3.0 zlib/1.2.5 libidn/1.22 libssh2/1.2.7
> Host: diy0-domaintest0002.dev.rhcloud.com
> Accept: */*
> 
< HTTP/1.1 400 Bad Request
< Date: Thu, 31 May 2012 10:55:15 GMT
< Server: BaseHTTP/0.3 Python/2.6.6
< Content-type: text/html; charset=UTF-8
< Vary: Accept-Encoding,User-Agent
< Strict-Transport-Security: max-age=15768000, includeSubDomains
< ProxyTime: D=6485
< Connection: close
< Transfer-Encoding: chunked
< 
<html>
<head><title>void *status400;</title></head>
<body><br/><h3>Custom 400 status code page</h3></body>
</html>
* Closing connection #0