[Building Sakai] Strange - proxyPort needed in serverl.xml to get request.getServerPort() to work

Matthew Jones matthew at longsight.com
Mon Mar 19 19:14:04 PDT 2012


Hmm, I run this on tomcat 7.0.21 (unmodified) and it returns 8080

<%@ page contentType="text/html; charset=iso-8859-1" language="java"  %>
<%
  String path = request.getContextPath();
  String getPort=Integer.toString(request.getServerPort());
%>
<html>
<body>
Port is <%=getPort%>
</body>
</html>

Weird that it would change for you, or detect it coming in as port 80.

On Mon, Mar 19, 2012 at 9:56 PM, csev <csev at umich.edu> wrote:

> I was re-testing IMS LTI Support in Sakai and came across a strange thing.
>
> My server was a fresh checkout, full compile, and a fresh Tomcat
> 7.0.21pulled from our maven repo.
>
> Deep in some OAuth code it was doing a
>
> request.getRequestURL()
> request.getServerPort()
>
> The server was running on 8080 and yet, the port was 80 and the URL had no
> :8080 - the URL makes sense if it mistakenly thinks the port is 80.
>
> I fussed around and then in a wild guess I made the following change to my
> server.xml:
>
>    <Connector port="8080" protocol="HTTP/1.1"
>               connectionTimeout="20000"
>               proxyPort="8080"
>               redirectPort="8443" />
>
> And it started working.   getServerPort() came back 8080 and the URL came
> back properly.
>
> Did some default change?  It almost seems like the proxyPort default used
> to be the same as port= - but is no longer the case.  I don't know when it
> broke...  Maybe I missed a memo...
>
> I am not talking about production with a real proxy - I am talking about a
> dev environment running straight-up on 8080.
>
> I am mostly curious and concerned to make sure our instructions are right
> here for a dev install on 8080..
>
> Thanks.
>
> /Chuck
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120319/88c2a5db/attachment.html 


More information about the sakai-dev mailing list