Homepage redirection

Hello all,

I would like add a redirection of the KNIME homepage server if a file is missing in a local directory. I saw it is possible to use instructions like RewriteCond and RewriteRule with Tomcat to check a condition and redirect the user if needed (like A Brief Look at the Rewrite Valve in Tomcat 8 - A Blog By Tony Junkes).

So I added <Valve className="org.apache.catalina.valves.rewrite.RewriteValve" /> in
<Host appBase="webapps"../> part of the KNIME server apache-tomcat-9.0.36/conf/server.xml file, and added a rewrite.config file in apache-tomcat-9.0.36/webapps/knime/WEB-INF. But it seems never read, I tried to put in in other folder but there is no change.

Do you know if it is possible to use a rewrite.config file to redirect KNIME homepage ?



When you say “when a file is missing in a local directory” can you explain in more detail what you mean? Maybe expand on the overall use case on what you want the user experiene to be, and we can try and figure out how it would work within KNIME.



Hi Jeff,

Here is my use case: To access to a KNIME webportal, the users have to Login first to be authentifiate. The user authentication and authorization are managed by a custom Java security module using a remote database with web services (JAAS Implementation in apache-tomcat configuration).
Everything is fine with this authentification, but sometimes we may have network issues and so the users cannot access server authentification (in this case there is a ‘Login failed. Please try again.’ error message if users try to log in to the KNIME server homepage). My goal is to check if the remote database for authentification is available before user connection, and redirect the homepage to an error page if services are not ready.

For that, I think:
Step 1: Use a script to check regularly if this database is accessible, to write a file in KNIME apache-tomcat directory if the service is down.
Step 2: if this file is absent then continue the authentication as usual, but if this file exists (means that the auth service is down) then redirect the user to an error page.

This topic is for the step 2, I saw that it is possible to check and redirect web page if a local file exists with Tomcat 8 RewriteCond and RewriteRule instructions but I haven’t found how to use it with our KNIME server. I tried to use rewrite.config file with these instructions but it never seems to be used.

Do you know how I could redirect the homepage in this case?


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Thanks to Marten and Jeff for your help about this topics, it’s done :slight_smile:

For anyone with the same problematic, here are the main steps that you can follow:

  1. Create a new webapp on the Tomcat server, e.g. create a new folder within the webapps folder with an index.html page.

  2. Add the rewrite valve into the server.xml:

<Host appBase="webapps" autoDeploy="false" name="localhost" unpackWARs="true">
    <Valve className="org.apache.catalina.valves.rewrite.RewriteValve" />
  1. Create a rewrite.config file in \apache-tomcat-x\conf\Catalina\localhost with redirection instruction like:
RewriteCond /file_redirection -f
RewriteRule  ^/knime.*$                 /redirect  [L]
  1. Create a cron bash that will create/delete the file_redirection file if needed to redirect the user to the good webapp.

Best regards


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.