From users-return-267666-archive-asf-public=cust-asf.ponee.io@tomcat.apache.org Fri Jun 7 08:41:45 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id BCF5818067E for ; Fri, 7 Jun 2019 10:41:44 +0200 (CEST) Received: (qmail 24096 invoked by uid 500); 7 Jun 2019 08:41:41 -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 24085 invoked by uid 99); 7 Jun 2019 08:41:41 -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; Fri, 07 Jun 2019 08:41:41 +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 D9E261A321A for ; Fri, 7 Jun 2019 08:41:40 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.801 X-Spam-Level: * X-Spam-Status: No, score=1.801 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id JKuion5DERrj for ; Fri, 7 Jun 2019 08:41:38 +0000 (UTC) Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 324285F180 for ; Fri, 7 Jun 2019 08:41:38 +0000 (UTC) Received: by mail-qt1-f170.google.com with SMTP id x47so1298960qtk.11 for ; Fri, 07 Jun 2019 01:41:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=6OFXNaxobww1muD78iR5AD+28w1xRfEKFmZGlzsyaqY=; b=HvhkqXY0GObkVXddJLjKrd6n9ND7dM1FGyKODqDOUaxoKYE70mD+zIm6IHISM1jghT MkskX0oGCQj7DZ6WUyL/urc/W3+Fb/67CwvIFsMii/3EtolH4FsgKofG5hFBU9m25W/6 wJr/l2h6oINjTsq5m8R5lh+0UnBUed7BTM9Vy23rfGfbXNGObSAjdWj/I8WPLVZGZcb4 Ew003WyMSYxTXRAMStGR8EnIppWCOdlx6CASwlhh12/ZB93mUJsMyvbPHZQUraNV//4H PVArkwtcW1V3Ht0YlApOk4fSvW7h2jfubaKMM0PiKz1m+vfL5+rDLipXoH1gEA8uC0en JecA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=6OFXNaxobww1muD78iR5AD+28w1xRfEKFmZGlzsyaqY=; b=JtfNY+DOMNT7RzzBx/Pl5k7tBkqqWjuFVVFhFg1MxgS/40wsLou2SkY6e8PQ5MwcZD 0uN39wjLLHpcEOJ9cUytlyZQ6A/mquIZLr342E0GLfRkeZfW1M4gG41vjXUYAK2zZASB FLiYVOmgmprPWQjVgCED32sT4aqGC+s2omVk7pGrJzwi05sil2ozZ65buOHqtfeZmsUp r2oDTAgY2DHJI8flf3wcnnm+D62kzMjk2H6VsHeG+wt8IHjgl+2zS8C6X/3aBaSnuutM Sm4F0SXJB/P51ACSEKzHY/psAKRfAtNYW/k2I7n/KCR3u+bOUCv85oevGm/9ut6JeEoc 57Bw== X-Gm-Message-State: APjAAAWZcuOVM1bKZdMngroluKAfm7jcQeqvzD7pPqH8fJkkFTusQbOd ZhXzPC3xgcicxsDMIFMwfZrFYEVOt0RKPaPEsyY7TC8B X-Google-Smtp-Source: APXvYqy6+7xOIa57vlPTE5862PwanDEDwtyZ+P5Ke53rf9lXneP0WjoSHtzcqdX6oKm8Q7yq/MLy3ixUIhA3pztPy6U= X-Received: by 2002:ac8:2b01:: with SMTP id 1mr37968764qtu.177.1559896891794; Fri, 07 Jun 2019 01:41:31 -0700 (PDT) MIME-Version: 1.0 References: <5CF92101.8030508@ice-sa.com> <5CFA0E71.1030507@ice-sa.com> In-Reply-To: <5CFA0E71.1030507@ice-sa.com> From: Rob Nikander Date: Fri, 7 Jun 2019 11:41:20 +0300 Message-ID: Subject: Re: How to stop trailing slash redirects? To: Tomcat Users List Content-Type: multipart/alternative; boundary="0000000000001f2b63058ab7ccb2" --0000000000001f2b63058ab7ccb2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jun 7, 2019 at 10:13 AM Andr=C3=A9 Warnier (tomcat) wrote: > On 07.06.2019 08:31, Rob Nikander wrote: > > > > > >> On Jun 6, 2019, at 5:19 PM, Andr=C3=A9 Warnier (tomcat) > wrote: > >> > >> On 06.06.2019 13:28, Konstantin Kolinko wrote: > >>> =D1=87=D1=82, 6 =D0=B8=D1=8E=D0=BD. 2019 =D0=B3. =D0=B2 10:32, Rob Ni= kander : > >>>> > >>>> [=E2=80=A6] > >>> > >>> 1. Exact version number of Tomcat =3D? Does it support that attribute= ? > > > > Version 9.0.20. > > > > Thank you both for the recommendations and warnings. At the moment I=E2= =80=99m > not sure what I=E2=80=99ll do. > > > > I often don=E2=80=99t think of URL paths like directories, but if I do = that, > then it makes some sense to redirect. But in my case, the url =E2=80=9C/m= yapp=E2=80=9D is > the entry point to my web app, and it currently returns an intro page, no= t > something that looks like a directory listing. Once you get into the app = it > has other URLs like /myapp/login, /myapp/browse, /myapp/practice, etc. I > don=E2=80=99t have a great reason for disliking the slash; it=E2=80=99s m= ainly subjective > preference of thinking the URLs without slash look simpler and cleaner. > > > > Maybe my best =E2=80=9Creason=E2=80=9D to do this is that the minimal b= ase URL /myapp is > the obvious entry point to the app, and my first choice to give out to th= e > public as the app=E2=80=99s location, so I want it to work as fast as pos= sible, > without a redirect. > > > > What I was trying to say, is that the redirect is needed so that *the > browser* would have > the correct URL for the page it is ultimately obtaining, so that *the > browser* can > correctly interpret any relative URLs which may exist in that page (and > cookie paths etc..). > Yes, I think understood what you were saying there about relative URLs. Even if I use the slashless URL, I'm glad you explained it because now I know why Tomcat is working that way. I think it my case it's not that difficult to change which URL I consider canonical, redirect /myapp/ =E2=86=92 /myapp, and deal with URLs and cookie= s accordingly. I need to change the defaults with cookies anyway since I want a site-wide session, not something restricted to /myapp. Most of the app is served from other URLs, like /myapp/login, /myapp/practice, etc., where this is not a factor. I already avoid relative URLs for some other reasons -- for example, they become extra confusing in apps like this which programmatically create UI components that can be reused on different pages/URLs, and which use the HTML5 history API (changes to the URL don't always result in server page requests). Rob --0000000000001f2b63058ab7ccb2--