Bug 63696 - uriworkermap does not work properly if it has /* pattern
Summary: uriworkermap does not work properly if it has /* pattern
Status: RESOLVED INVALID
Alias: None
Product: Tomcat Connectors
Classification: Unclassified
Component: isapi (show other bugs)
Version: 1.2.46
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-26 04:02 UTC by kimc.log
Modified: 2019-08-26 08:19 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kimc.log 2019-08-26 04:02:42 UTC
I configured uriworkermap.properties like the following.

* uriworkermap.properties
/tomcat*=tomcat
/*=root

I wanted them to act like that first /tomcat pattern send all the request starting with that pattern to tomcat worker and the other pattern send to root worker which has another web application.
But the result always choose /* pattern... why?
You can see the logs below, Found a wildchar match '/*=root'
Please tell me if there is another way to do what I want?

* workers.properties
worker.list=tomcat,root
worker.tomcat.type=ajp13
worker.tomcat.host=localhost
worker.tomcat.port=10190
worker.root.type=ajp13
worker.root.host=localhost
worker.root.port=10290

* isapi_redirector's log
[Mon Aug 26 10:29:36.840 2019] [17872:4280] [debug] uri_worker_map_dump::jk_uri_worker_map.c (197): NEXT (1) map #0: uri=/tomcat* worker=tomcat context=/tomcat* source=uriworkermap type=Wildchar len=6
[Mon Aug 26 10:29:38.288 2019] [17872:4280] [debug] uri_worker_map_dump::jk_uri_worker_map.c (197): NEXT (1) map #1: uri=/* worker=root context=/* source=uriworkermap type=Wildchar len=2
[Mon Aug 26 10:29:39.690 2019] [17872:4280] [trace] uri_worker_map_dump::jk_uri_worker_map.c (207): exit
[Mon Aug 26 10:29:41.082 2019] [17872:4280] [trace] uri_worker_map_ext::jk_uri_worker_map.c (633): exit
[Mon Aug 26 10:29:42.330 2019] [17872:4280] [trace] uri_worker_map_switch::jk_uri_worker_map.c (597): enter
[Mon Aug 26 10:29:43.569 2019] [17872:4280] [debug] uri_worker_map_switch::jk_uri_worker_map.c (602): Switching uri worker map from index 0 to index 1
[Mon Aug 26 10:29:46.216 2019] [17872:4280] [trace] uri_worker_map_switch::jk_uri_worker_map.c (609): exit
[Mon Aug 26 10:29:47.385 2019] [17872:4280] [info] init_jk::jk_isapi_plugin.c (2687): Tomcat/ISAPI/isapi_redirector/1.2.46 initialized
[Mon Aug 26 10:29:48.524 2019] [17872:4280] [debug] handle_notify_event::jk_isapi_plugin.c (1718): Filter started
[Mon Aug 26 10:29:49.927 2019] [17872:4280] [debug] jk_servlet_normalize::jk_util.c (2185): URI on entering jk_servlet_normalize: [/tomcat/test.jsp]
[Mon Aug 26 10:29:51.364 2019] [17872:4280] [debug] jk_servlet_normalize::jk_util.c (2279): URI on exiting jk_servlet_normalize: [/tomcat/test.jsp]
[Mon Aug 26 10:29:52.666 2019] [17872:4280] [trace] map_uri_to_worker_ext::jk_uri_worker_map.c (1080): enter
[Mon Aug 26 10:29:53.585 2019] [17872:4280] [debug] uri_worker_map_update::jk_uri_worker_map.c (1295): File E:\Migration\isapi\tomcattest\uriworkermap01.properties is not modified
[Mon Aug 26 10:29:53.900 2019] [17872:4280] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1140): Prefixing mapping uri with vhost '/localhost:48080'
[Mon Aug 26 10:29:55.301 2019] [17872:4280] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1168): Attempting to map URI '/localhost:48080/tomcat/test.jsp' from 2 maps
[Mon Aug 26 10:29:56.639 2019] [17872:4280] [trace] find_match::jk_uri_worker_map.c (967): enter
[Mon Aug 26 10:29:57.018 2019] [17872:4280] [debug] find_match::jk_uri_worker_map.c (978): Attempting to map context URI '/tomcat*=tomcat' source 'uriworkermap'
[Mon Aug 26 10:29:57.322 2019] [17872:4280] [debug] find_match::jk_uri_worker_map.c (978): Attempting to map context URI '/*=root' source 'uriworkermap'
[Mon Aug 26 10:29:58.285 2019] [17872:4280] [debug] find_match::jk_uri_worker_map.c (991): Found a wildchar match '/*=root'
[Mon Aug 26 10:29:58.786 2019] [17872:4280] [trace] find_match::jk_uri_worker_map.c (994): exit
[Mon Aug 26 10:30:00.200 2019] [17872:4280] [trace] map_uri_to_worker_ext::jk_uri_worker_map.c (1198): exit
Comment 1 Rainer Jung 2019-08-26 08:19:59 UTC
As far as I remember, the isapi redirector support some kind of virtual hosting in IIS by first prefixing the URL with the local server name before mapping the request using uriworkermap.properties. Only if it can't map that URI, it will next try the raw URI without prefixed vhost.

So the log tells us, that it first tries to map

/localhost:48080/tomcat/test.jsp

and that URI matches the root map, not the tomcat map.

I guess port 48080 is something you configured. If that is stable, you could try the follwoing rules instead in uriworkermap.properties:

/localhost:48080/tomcat*=tomcat
/localhost:48080/*=root

Any non-root context mapping would not require the vhost prefix in the rules, because it would never match a /HOST:PORT/ prefixed URI. Only /* unfortunately matches it.

Alternatively you can stay with your config but add another first rule (exclusion rule starting with an exclamation mark):

!/localhost:48080/tomcat*=root

You can read a bit about the IIS vhost feature and maps under:

http://tomcat.apache.org/connectors-doc/reference/uriworkermap.html#Virtual_host_integration

Regards,

Rainer