Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2D229200D0A for ; Wed, 4 Oct 2017 09:53:47 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2BCD91609E2; Wed, 4 Oct 2017 07:53:47 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 71C881609D6 for ; Wed, 4 Oct 2017 09:53:46 +0200 (CEST) Received: (qmail 75433 invoked by uid 500); 4 Oct 2017 07:53:44 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 75421 invoked by uid 99); 4 Oct 2017 07:53:44 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Oct 2017 07:53:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id EB4C51A11F5 for ; Wed, 4 Oct 2017 07:53:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=6.31 tests=[none] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id XkOT8xF_4g-u for ; Wed, 4 Oct 2017 07:53:41 +0000 (UTC) Received: from thor.wissensbank.com (thor.wissensbank.com [81.169.250.120]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 3F1ED60D94 for ; Wed, 4 Oct 2017 07:53:38 +0000 (UTC) Received: from thor.wissensbank.com (localhost [127.0.0.1]) by thor.wissensbank.com (Postfix) with ESMTP id A93D73DC808D2 for ; Wed, 4 Oct 2017 09:53:32 +0200 (CEST) Received: by thor.wissensbank.com (Postfix, from userid 500) id 99E423DC808D6; Wed, 4 Oct 2017 09:53:32 +0200 (CEST) Received: from [192.168.245.129] (pd956abfc.dip0.t-ipconnect.de [217.86.171.252]) (Authenticated sender: andre.warnier@ice-sa.com) by thor.wissensbank.com (Postfix) with ESMTPA id 812953DC808D2 for ; Wed, 4 Oct 2017 09:53:30 +0200 (CEST) Subject: Re: encodeURL, jsessionid and mod_rewrite ? To: users@tomcat.apache.org References: <6e827382-25c7-0be0-a62b-40a6a9fd40e6@christopherschultz.net> From: =?UTF-8?Q?Andr=c3=a9_Warnier_=28tomcat=29?= Message-ID: <59D49374.5000309@ice-sa.com> Date: Wed, 4 Oct 2017 09:53:24 +0200 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <6e827382-25c7-0be0-a62b-40a6a9fd40e6@christopherschultz.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP archived-at: Wed, 04 Oct 2017 07:53:47 -0000 On 04.10.2017 02:44, Christopher Schultz wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > Laurant, > > On 10/3/17 5:17 PM, Laurent Perez wrote: >> I'm using apache+mod_proxy+mod_rewrite as a tomcat frontend. A >> "foo" war is deployed at /foo context path under tomcat. The /foo >> path is not public, apache has a rewrite rule defined as : /bar/* >> rewrites internally to /foo/*. >> >> I'm using jstl and its for every url in my >> jsps to gain the ;jsessionid from encodeURL whenever jsessionid >> cookie is not yet set (1st requests) >> >> Now my question is : the results in a >> "/foo/page.jsp;jsessionid=..." I want the result instead as >> /bar/pages.jsp;jsessionid=.... >> >> Should I go straight for a HttpServletResponseWrapper replacing >> every /foo/ with /bar/ or is there a more elegant way ? If the >> apache rewrite rule is modified - say, to /barv2/, is it ok to use >> mod_headers to pass the original path instead of hardcoding /bar/ >> ? > > You are going down a path that will produce endless problems, hacks, > and ugly solutions to those problems. It will be much easier for you > to simply re-name your application from "foo" to "bar" and not worry > about any of this rewriting foolishness. > > - -chris +1. I can only agree 100% with what Chris is saying above. The fact that you /can/ do these things at the front-end proxy level, does not mean that it is a good idea to do it. There are probably cases when you can *really* not do otherwise, and that's why these mechanisms are there. But doing this, brings endless other practical inconvenients, extra work, confusion, documentation issues, understanding issues 6 months later, support issues, etc. So, in a nutshell : don't do it. P.S. The annoying bit about recommendations such as the above, is that if you follow them, you will not even know how much work and hassle you have saved to yourself, and 1) you will not even feel thankful and 2) we won't have the satisfaction of saying later : "well, we told you so" ;-) --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org