-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 André,
On 7/18/17 8:29 AM, André Warnier (tomcat) wrote: > Hi. > > On 18.07.2017 14:09, Jan Hlavatý wrote: >> Hello, >> >> I can't seem to figure out the proper setup for the situation >> where I have multiple webhosts behind a reverse proxy server >> being forwarded to Tomcat. >> >> There can be only one proxyHost and proxyPort on a Connector but >> I have multiple Hosts and Aliases. >> >> How am I supposed to do that? Make multiple Connectors one per >> hostname, on different local ports, sharing on Executor to avoid >> multiplying threads, and have the proxy forward to different >> ports based on hostname? >> > > No to all that. All you need is multiple <Host> entries in the > tomcat server.xml config. A single <Connector> (and port) will do > for all. <Executor> is optional, and indeed relates to optimising > the usage of threads. > > Other than that, I don't really know at what level to begin > explaining why. Let's try this : > > In HTTP 1.1 and above, when a browser sends a request to a server, > it adds a header line to each request : Host: some.server.com > > The receiving HTTP server reads this header, and that is what tells > it to which of it's "hosts" this request is adressed. > > If you have a front-end reverse proxy, and say 10 virtual hosts, > then each of these virtual host names is configured in the DNS to > resolve to the IP address of your proxy. So the front-end proxy > receives all requests directed to any of these hosts. It then > belongs to the proxy, to forward all these requests to the single > back-end Tomcat server, and include the original "Host:" header in > the requests that it proxies so. > > The single Tomcat Connector will receive all these requests, and > will dispatch them to each individual <Host> in function of that > same "Host:" header. +1 See point 5 in: https://tomcat.apache.org/tomcat-8.0-doc/proxy-howto.htm l Also see the list of bullet points under https://tomcat.apache.org/connectors-doc/common_howto/proxy.html, specifically this one: " * local name: getLocalName(). This is also equal to getServerName(), unless a Host header is contained in the request. In this case the server name is taken from that header. " So, basically, if you simply don't configure any proxyHost or proxyPort at all, I think you'll get the behavior you desire. - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlluDf4ACgkQHPApP6U8 pFiboQ/+Po/u6b4OwC0Nsel1sbN3TA8cIyrASDy4NmYjlNLw3DSTBMo38VVK1Rqm +L4sLFBBdJ/01eH6ahEHmJGE9Cifg72i/ldsqFfrLD9kglSOa8Y4iJtRkMyq8qgr ElkzLY+phBDNVk45ePQ0dSEW97i/HJI3/DSaRGLxmiI2a7FDSQEM7Y1E5ZEvQ1nQ q+A0zrr0+yxJmKEjx1u0q1ehiAqcK1P3QpcSsBOGEIliDoalCdSMIZgYnl0ok9sR LeKnc5+2Xz3QWwpRRPhUFb+2AXLe7MBG2YKwJxCJraRn+ets12MV5NrpNg0NHUOz knlJL6auc2m1vaU1fOjN5tzS4O9pBmT/eM7f35gNz9A9ggmOcwOnyd9hZ7NZh20h 7vEkvBKMA0C+8aO2w4cICm+25b2Oy6ut5mGHCZz68MY2s8dfEGo614nFIdlQtklu QmhlTCj4cw8kNdGZ9ayfvSOaLD3O/lz6azpLWGHP0qGUvtTB4TqMI3CqNtuDxwWO vzU8jXKaTFxnCMphgpMxwLOxUlbEjOEfWJeIARasNKJswgHEHFEe9XGNyfMXP6zC 7RTACy5nvX6FWm0U0RtzXrF0zKbqTaeRtNoI+wmkhrsDbEuVqMPUoG/UhBP1NEmZ QkHCEoJaAxmFU/qC5FIyU88sM8Y8rhiRqkhT6E8oNriv8VtT+Xw= =vjQ7 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org