tomcat-valve

Re-writing tomcat 8 urls

ぐ巨炮叔叔 提交于 2020-07-19 07:46:08
问题 I have two tomcat applications deployed under two different contexts: someurl.com/context1/ someurl.com/context2/ I need to intercept urls in the form: someurl.com/clientname/context1/ and redirect them to url: someurl.com/context1/clientname where "clientname" is dynamic I have tried using a rewrite valve in the element of my tomcats server.xml file, but it still works only for urls which include the context. i.e.: someurl.com/context1/clientname/context1 gets re-written to someurl.com

How to add Valve to Apache Tomcat

◇◆丶佛笑我妖孽 提交于 2019-12-23 09:56:04
问题 I wrote a Valve for Apache Tomcat by extending org.apache.catalina.valves.ValveBase class and implementing inovoke() method. Now I want to add it to my Tomcat for execution? Please show me the steps. 回答1: Create a jar with your Valve class. Drop this into the $TOMCAT_HOME/lib folder. Modify the server.xml to add the valve under Engine or Host tag as shown below, depending on which level you want it to operate. <Engine name="Catalina" defaultHost="localhost"> <Valve className="org.whatever

Why is my tomcat valve not being invoked?

≡放荡痞女 提交于 2019-12-20 04:38:49
问题 I try to implement a Tomcat valve (currently using 7.0.55) that should intercept every request that reaches the Tomcat serivce, regardless of Connector and whatnot, regardless of wether there's a Host with matching name or a servlet context or whatever. The invoke -method of the valve looks like this: public class MyValve extends ValveBase { public void invoke(Request request, Response response) throws IOException, ServletException { LOG.trace("Valve is being invoked"); getNext().invoke

Tomcat: Custom form authenicator in a web application, not as a stand-alone JAR module. Possible?

两盒软妹~` 提交于 2019-12-20 04:34:51
问题 Our web application requires custom form authentication with specific logic inside. The current form authenticator implementation requires the authenticator module, let's call it custom.auth.jar , to be present in %CATALINA_HOME%/lib before the web application starts. The web application uses that custom authenticator module using the following context.xml directive: <Valve className="foo.bar.CustomAuth" characterEncoding="UTF-8"/> As far as I understand Tomcat requirements, this module,

Javascript being loaded twice after enabling rewrite through Tomcat valve

蹲街弑〆低调 提交于 2019-12-12 04:21:52
问题 I have a single page application, and I am using the tomcat rewrite valve to forward all the requests other than static resources to my index.html. Following are the contents of my rewrite.config: RewriteCond %{REQUEST_URI} (?!.*\.(?:jpg|png|css|js|json|scss|map)$).*$ RewriteRule ^.*$ /index.html [L,QSA] After getting the rewrite to work, I am seeing that my jQuery library, and other javascript files are loading twice. This is causing the application to break. Could someone point out what

How to modify Tomcat's response header with valves?

老子叫甜甜 提交于 2019-12-11 18:03:49
问题 I need to minimize Tomcat's response header. The device sending requests to tomcat is very limited in memory, so I want to remove the headers Date, Server and Content-Type. I set up my own valve with an action hook. The hook gets called, but it seems to be impossible to remove the date and server header. First I executed my method only when ActionCode == COMMIT - didn't work. Strange. So I looked in the Tomcat source code: In the method action() of Tomcat's AbstractHttp11Processor when

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

…衆ロ難τιáo~ 提交于 2019-12-11 09:32:27
问题 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 the log file: [WARNING] [talledLocalContainer] WARNING: Parameters: Character decoding failed. Parameter 'ì°ÅM©2a 7)ýúVßiPÑUÙvPÏB%<kNíR¹YÃÁéIÿ4^ØsZ' with value '' has been ignored. Note that the name and value quoted here may corrupted due to the

Valve does not capture POST requsts to j_security_check

我是研究僧i 提交于 2019-12-11 04:29:23
问题 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 requests should be handled by my Valve. I'm using Payara 5, Form-based authentication, GlassFishValve, and WEB-INF contains a glassfish-web.xml containing <!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet

Tomcat 9 Valve Causing Server Start Failure

六月ゝ 毕业季﹏ 提交于 2019-12-08 03:45:36
问题 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 AuthenticatorBase { private String[] roleNames = null; private String ivcreds = null; private String ivuser = null; private String ivgroups = null; private GenericPrincipal principal = null; // Constructor defers to super class (Authenticator base) public

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

拜拜、爱过 提交于 2019-12-08 02:08:08
问题 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 回答1: I found the answer for this. You can improve the delay by disabling buffering. Flag "buffered" determine if logging will be buffered. If set to false, then access logging will be written after each request. Default value: true. Therefore, adding