Hi all,

I’ve been trying to get this to work for a bit without any luck.

What I’ve arrived at, in my main Tomcat web.xml, is:

<web-app xmlns=http://xmlns.jcp.org/xml/ns/javaee
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd";
  version="4.0">

    <filter>
      <filter-name>Remote Address Filter</filter-name>
      <filter-class>org.apache.catalina.filters.RemoteAddrFilter</filter-class>
      <init-param>
        <param-name>allow</param-name>
        <param-value>127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1</param-value>
      </init-param>
    </filter>
    <filter-mapping>
      <filter-name>Remote Address Filter</filter-name>
      <url-pattern>/sru/*</url-pattern>
    </filter-mapping>

This is more-or-less a copy/paste from the documentation at 
https://tomcat.apache.org/tomcat-9.0-doc/config/filter.html#Remote_Address_Filter,
 but the url-pattern is presenting me some problems.

There are (for various business reasons) planned to be two applications on this 
Tomcat – one at “/sru/…” and one not.

The one at “/sru” needs to have a filter applied to stop it being accessed from 
non-whitelisted sources. The other application is public.

Or, I need to do some development work to integrate with our corporate 
authentication mechanism – for requests that have already been authenticated 
and are arriving from another, internal, server. To me, that seems like a waste 
of time.

If I adjust the url-pattern to:
      <url-pattern>/*</url-pattern>

… then all access from other clients for both applications get an http/403 
response. No surprise, there.

If I make the pattern:
      <url-pattern>/sru/*</url-pattern>
               (or some variations thereof – “sru”, “/sru”, “/sru/”, “/sru*”, …)

… then both applications are equally accessible from other clients.

Is what I’m trying to do possible?
               I’m using Tomcat 9.0.54.

If it should work – can anyone spot what I’ve missed?

Thanks,
Tim

--
Tim Scott
OCLC · Senior Software Engineer / Technical Product Manager
CityGate, 8 St. Mary’s Gate, Sheffield S1 4LW, UK

cc: IT file

OCLC COVID-19 resources: 
oc.lc/covid19-service-info<https://oc.lc/covid19-service-info>
[COVID-19: We’re in this 
together]<https://www.oclc.org/en/covid-19.html?utm_campaign=covid-19-support&utm_medium=email&utm_source=libraryservices&utm_content=signature-banner-covid-19-information-resources>

Reply via email to