Questions tagged [tomcat-valve]

A Valve is a type of component that can be inserted into Tomcat's request/response pipeline in order to add application-specific logic.

A Valve is a type of component that can be inserted into Tomcat's request/response pipeline in order to add application-specific logic in relation to request processing.

There are many kinds of valves dealing with different aspects of the server's operation and functionality, some of which include:

  • Logging
  • Authentication
  • SSL
  • Single Sign On
  • stuck thread detection

For more information, visit the Apache Tomcat documentation

76 questions
2
votes
1 answer

Extending ValveBase in Tomcat always returns null for request.getRemoteUser()

I have tested this in both Tomcat 8.0.51 and 9.0.14 with same results. Running on Ubuntu Linux 16.04. This example code simply logs all requests to the console (or catalina.out). The main issue is that request.getRemoteUser() always returns null -…
Ted Cahall
  • 196
  • 1
  • 11
2
votes
2 answers

Tomcat HTTP Access log has a delay in writing to the file

In tomcat http access log valve takes some time to write to file. Please note I have default configurations for org.apache.catalina.valves.AccessLogValve. Are there anyways to improve the latency? And what are the key reasons for this delay
poohdedoo
  • 1,258
  • 1
  • 18
  • 42
2
votes
2 answers

How to identify URIs of active (long-running) HTTP requests?

Imagine a webapp which (sometimes) takes long time to respond to some HTTP (POST/GET/etc) request - how would You find such a request on server side? So far I've used tomcat AccessLogValve to see the "completed" requests, but that doesn't let me to…
Vlad
  • 1,157
  • 8
  • 15
2
votes
1 answer

org.apache.catalina.authenticator.SingleSignOn valve portability

I am thinking of using the tomcat org.apache.catalina.authenticator.SingleSignOn valve for my single sign on, as documented here If I go with this approach, what would I need to do to my applications if I decide to move my application from tomcat to…
Chris Snow
  • 23,813
  • 35
  • 144
  • 309
2
votes
2 answers

Tomcat: Getting 'Character decoding failed' in logs; possible malicious attack?

I just had a Tomcat instance stop responding (it started working fine after being killed and restarted), and in the log messages it looks like right before it stopped responding someone was spamming it with invalid requests. Here's an excerpt from…
aroth
  • 54,026
  • 20
  • 135
  • 176
1
vote
0 answers

Use a Jboss/Tomcat valve to encrypt/decrypt urls like some url-rewriting?

I have a third party application running on JBoss using servlets and jsps. I do not have access to the source code. Let's say one servlet runs like this : http://localhost/myApp/view.do?clientId=45&command=34 I want to obtain this :…
charly's
  • 279
  • 1
  • 3
  • 16
1
vote
0 answers

Tomcat Rewrite Outbound Rule

I am working on a web application that uses Tuckey's UrlRewriteFilter for url rewriting. We are looking to migrate to jakarta and intend to also move away from the UrlRewriteFilter and use Tomcat's rewrite valve instead, as suggested by Paul Tuckey…
1
vote
1 answer

How to measure execution time of request without network transfer time?

In my valve I get the execution time of my http query like that : public void invoke(Request request, Response response) throws IOException, ServletException { long t1 = System.currentTimeMillis(); getNext().invoke(request, response); long t2 =…
jpprade
  • 3,497
  • 3
  • 45
  • 58
1
vote
1 answer

Tomcat 9: valve redirection of http to https only works for base URL?

We have a Tomcat-based server where both port 80 and port 443 are valid and working correctly. We recently added a valve to redirect all requests from port 80 to port 443, with the following rewrite.config: RewriteCond %{SERVER_PORT} =80 RewriteRule…
pbeentje
  • 303
  • 2
  • 7
1
vote
1 answer

Does forwarding request from one servlet to another makes it to go through valve defined?

I have a authenticator valve defined in tomcat, So I have a servlet which is unprotected(doesn't comes under security constraint) will preprocess those request and forward it to a protected servlet. The forward will contain the necessary parameter…
1
vote
0 answers

Error on Restrict Access by IP in Apache Tomcat 6.0.20

I would like to restrict to access to the Tomcat page by configuring the following in my conf/Catalina/[host]/[app].xml
Jacelyn
  • 103
  • 1
  • 1
  • 4
1
vote
1 answer

Tomcat URL Redirect Issue

Tomcat : 8.5.30 Java 8 OS : macOS Mojave 10.14.6 As a sample project, I'm trying to redirect any url : /{dynamicValue}/entity/{entityID} to /entity/{dynamicValue}/entity/{entityID}. Here the 'entity' is my context and will be referencing entity.war…
El Cid
  • 191
  • 1
  • 12
1
vote
1 answer

Tomcat 8 Log when http body finishes write; ServletOutputStream closes? Valve %D?

I have a WAR file I am deploying in Tomcat 8. It is using Spring Boot, which is pretty much incidental. I want to log how long it takes for the client to finish consuming my http responses, since the bodies of my responses are large. That means…
MeowCode
  • 1,053
  • 2
  • 12
  • 29
1
vote
0 answers

Valve does not capture POST requsts to j_security_check

I have written a Valve that logs all requests to my webapp. But requests to mywebapp/j_security_check don't show up. Am I missing something, or is impossible? I understand that the call chain should be Valve > JAAS > Filter > Servlet, so those…
Per Lindberg
  • 737
  • 8
  • 8
1
vote
2 answers

Tomcat 9 Valve Causing Server Start Failure

I have written a custom tomcat valve to parse HTTP headers and use them to authenticate. The valve works by extending AuthenticatorBase. I compiled it and placed it in $CATALINA_HOME/lib. Here is code: public class TomcatLogin extends…
willh99
  • 185
  • 1
  • 18