Tuesday, July 16, 2013

weblogic servlet redirect HTTP 302

If you deploy a WebApp, in a WebLogic cluster with a FrontEnd HTTP Host set (a loadbalancer typically), the Servlet will generate a redirect if the URL doesn't end with a /:

 wget "http://acme2-osbpr1ms2.acme.com:8001/gridlinkha"                                                            --2013-07-16 13:46:54--  http://acme2-osbpr1ms2.acme.com:8001/gridlinkha
Resolving acme2-osbpr1ms2.acme.com... 10.11.5.181
Connecting to acme2-osbpr1ms2.acme.com|10.11.5.181|:8001... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://acmev2.acme.com/gridlinkha/ [following]
--2013-07-16 13:46:54--  http://acmev2.acme.com/gridlinkha/
Resolving acmev2.acme.com... 10.11.5.35
Connecting to acmev2.acme.com|10.11.5.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1308 (1.3K) [text/html]
Saving to: `index.html.2'

100%[=====================================================================================================>] 1,308       --.-K/s   in 0s

2013-07-16 13:46:54 (96.0 MB/s) - `index.html.2' saved [1308/1308]



but if you append a /, the HTTP 302 is not generated.

wget "http://acme2-osbpr1ms2.acme.com:8001/gridlinkha/"


--2013-07-16 13:50:26--  http://acme2-osbpr1ms2.acme.com:8001/gridlinkha/
Resolving acme2-osbpr1ms2.acme.com... 10.11.5.181
Connecting to acme2-osbpr1ms2.acme.com|10.11.5.181|:8001... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1308 (1.3K) [text/html]
Saving to: `index.html.3'

100%[=====================================================================================================>] 1,308       --.-K/s   in 0s

2013-07-16 13:50:26 (113 MB/s) - `index.html.3' saved [1308/1308]



It took me forever, and this post, to figure it out.

Oracle support says that by using virtualhost you can avoid redirect.

No comments: