Roger C S Wernersson
Roger C S Wernersson

Reputation: 6562

How can I tell from the logs that a request to my Tomcat server used HTTP or HTTPS?

I'm changed my iPhone app from using HTTP to using HTTPS and it just worked.

I doubt that it is actually working though. How can I check, from my Tomcat server log files (or similar), that the request actually used HTTPS?

Upvotes: 1

Views: 1493

Answers (1)

Steve Schneider
Steve Schneider

Reputation: 402

Log the return value of request.isSecure() from a Servlet or JSP and see.

BUT: be aware that Tomcat, if not configured properly, won't KNOW if it's serving securely or not. This is the case whether your SSL cert terminates at your load balancer (or web server sitting in front of Tomcat), or if Tomcat is handling SSL traffic directly. Your (in server.xml) for HTTPS requests must have the secure="true" attribute; the default is "false". If secure is set to false (or not set), then Tomcat may be successfully handling SSL connections, but when you call isSecure() from within a Servlet (or JSP), it'll return false.

I don't know if the secure attribute affects how Tomcat logs traffic or not, but it may.

Upvotes: 2

Related Questions