Tomcat rewrite valve and Servoy WebClient

Questions and Answers on installation, deployment, management, locking, tranasactions of Servoy Application Server

Tomcat rewrite valve and Servoy WebClient

Postby steve1376656734 » Tue May 17, 2016 11:50 am

Hi,

I am trying to use the Tomcat rewrite valve to map a specific domain name to the web client startup screen in a specific context (e.g http://app.mydomain.com gets rewritten to http://app.mydomain.com/myContext/servo ... /s/AppName). I have enabled the rewrite valve for my ROOT context and placed the following in the rewrite.config file:

Code: Select all
RewriteCond %{HTTP_HOST} ^app.mydomain.com$
RewriteRule ^/index.jsp$ /myContext/servoy-webclient/ss/s/AppName [L]
RewriteRule ^$ /myContext/servoy-webclient/ss/s/AppName [L]
RewriteRule !^/myContext/.*$ [C]
RewriteRule ^/(.*)$ /myContext/$1 [L]

If I then enter the URL http://app.mydomain.com/servoy-admin then I am taken to the admin screen within the myContext context and everything works as expected. I can use all the admin functions with no issue and the URL displayed in the browser does not show the context part. If however I try and go to the actual application by entering http://app.mydomain.com I can see the initial "Loading..." message come up but then my screen remains blank and I get the following error in the Servoy log:

Code: Select all
Time                 Thread                Level    Category                                        Message                                  ClientId   Solution Name
2016-05-17 09:36     http-nio-8080-exec-3  ERROR    org.apache.wicket.protocol.http.WicketFilter    closing the buffer error       
java.lang.IllegalArgumentException
       at org.apache.catalina.connector.Response.normalize(Response.java:1709)
       at org.apache.catalina.connector.Response.toAbsolute(Response.java:1629)
       at org.apache.catalina.connector.Response.encodeRedirectURL(Response.java:1094)
       at org.apache.catalina.connector.ResponseFacade.encodeRedirectURL(ResponseFacade.java:429)
       at org.apache.wicket.protocol.http.WebResponse.redirect(WebResponse.java:276)
       at org.apache.wicket.protocol.http.BufferedWebResponse.close(BufferedWebResponse.java:67)
       at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:502)
       at com.servoy.j2db.server.servlets.Zu.doGet(Zu.java:6)
       at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:160)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
       at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
       at org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:260)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
       at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
       at org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:474)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
       at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
       at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
       at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
       at java.lang.Thread.run(Thread.java:745)

There is no ClientId or Solution Name given in the log which seems odd.

Can anyone give me any pointers as to what i am doing wrong? Alternatively if you have a working example using the UrlRewriteFilter from Tuckey.org then I would be grateful as I should be able to adapt that for the Tomcat rewriteValve.

Many thanks
Steve
Steve
SAN Developer
steve1376656734
 
Posts: 180
Joined: Fri Aug 16, 2013 2:38 pm
Location: Lanzarote

Re: Tomcat rewrite valve and Servoy WebClient

Postby jcompagner » Mon May 23, 2016 11:54 am

i am not sure if that will really work, because rewriting the above then wicket relative urls are not all working correctly

Because the page is also hitting stuff below that /myContext/servoy-webclient/ss/s/AppName (so it also wants to ave urls like myContext/servoy-webclient/resources/xxx and so on)

So to rewrite that we really need to look deep into it, but i think the "myContext" can be rewritten and maybe also myContext/servoy-webclient but more i don't think so)
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 7977
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Servoy Server

Who is online

Users browsing this forum: No registered users and 1 guest