How do I get current server port from cgi variables

When I’m on SSL lucee returns port 80 and secure as 0.
server_port=80
server_port_secure=0

What changes do I need to make to return the correct values.

To get the correct CGI remote_addr/remote_host I followed these instructions.
http://utdream.org/post.cfm/railo-cgi-remote-addr-remote-host-says-127-0-0-1

and updated my server config to use

<Engine name="Catalina" defaultHost="127.0.0.1">
<Valve className="org.apache.catalina.valves.RemoteIpValve" />

Thanks!

I assume you’re doing SSL termination outside Tomcat - so you’d want to
make sure that service (nginx/apache/haproxy/pound/etc) is advertising the
actual port information via headers. (i.e. X-Forwarded-Proto,
X-Forwarded-For, etc)

Based on that you’ll want to configure RemoteIPValve. Here’s mine

Such that 172.24.6.131 is my internal IP. Note the ip comparisons are
regex, not subnets.

-G

2 Likes