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 2C5DF200D34 for ; Fri, 3 Nov 2017 13:19:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 2AE4E160BFB; Fri, 3 Nov 2017 12:19:00 +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 7149B160BE9 for ; Fri, 3 Nov 2017 13:18:59 +0100 (CET) Received: (qmail 32554 invoked by uid 500); 3 Nov 2017 12:18:57 -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 32543 invoked by uid 99); 3 Nov 2017 12:18:57 -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, 03 Nov 2017 12:18:57 +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 078FB1A5A52 for ; Fri, 3 Nov 2017 12:18:57 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.879 X-Spam-Level: * X-Spam-Status: No, score=1.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-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 FAonfMnCVpJA for ; Fri, 3 Nov 2017 12:18:56 +0000 (UTC) Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id AC0CA5F566 for ; Fri, 3 Nov 2017 12:18:55 +0000 (UTC) Received: by mail-wm0-f42.google.com with SMTP id r68so1285989wmr.0 for ; Fri, 03 Nov 2017 05:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=XUikrcxAsJMqlXi/D0NUb3nbDzicZNl4w3IGOBNB1Ig=; b=j1TaiffOlfK6KnUKDT+sTZMheujSLPFpth0bJSvXd0tW+4yFF84ltzHpK1DF17W+Co vyNlBgC9ciDRB9K3bmdk8H0Ygv/hJQ7NCqbF3E25zVfpigWM/nXhagf4YkDYyzlcZRUc IkFS+/Xt6bTizUsMLMnh3o2yYIjC/NylAaBbHKTPbbT8f4ehc6BLXK0r2UEFNzNidYlw 5d4KNxceaHzhz9tYbRzx2vh4AiYgVJVm5N9CD1OWYHiL1XZY9DGz/oLCu04/i9a4j4v7 jF9z0xlEBE1sA63OLXI6M+BJOU8H60b3q7erUEcCRBSXflCc8Z4H1CkXFPyXb1On+87x y6gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=XUikrcxAsJMqlXi/D0NUb3nbDzicZNl4w3IGOBNB1Ig=; b=FPG53LO3zmsbdLKxzfgoE1lmNHa+/7ltbUrvMKTzUAJBZKwsw6YAAFPOg5PHftvTME OQPd/dIKZZeP5XXLcNg9Qlxjm/9qfEpJLXrnY5N/eKOZ8sdvmnZhwYJ7/UhSwuXxfqOj wbUP9h4z4s0EBmGNc6OCMu3BOwc7JYhWUYefPJPwQpFwwV6PKnE446/tDa0hJYb4fzCW Y9l6E0PQj0kKZJIF3l05XryC/Qjo4qEvsE29RxFKvKRcTRTCwR00YwECICq48FOCRJ2e Csl9qEHJEP/VcMLrmIrwO5JCIQqgKPBZDbHogDJfnvf7z/S1q/ZUqPAO4eZNm52QPord 3MxQ== X-Gm-Message-State: AMCzsaXs6rFSGiznhTSykQ9DhvY2qwDbk58Z3uV+/LuSbvZGoXk7byBb FdaPE7Fmds84fKa2DeMnXQWdCyxoBfuZfMAH4EqE23fj X-Google-Smtp-Source: ABhQp+SUkJWwK6A9sDXjJ4TZ2W+AaBbAWqLcV07Zb/HF/pHVpxpqzAZfGlH8R4wmc6p7EJ+09IaMSI1JIvz/ipK9wUI= X-Received: by 10.28.127.206 with SMTP id a197mr3932999wmd.12.1509711534487; Fri, 03 Nov 2017 05:18:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.200.137 with HTTP; Fri, 3 Nov 2017 05:18:53 -0700 (PDT) From: Enrico Olivelli Date: Fri, 3 Nov 2017 13:18:53 +0100 Message-ID: Subject: HttpServletRequest in AsyncContext does not handle X-Forwarded-For (RemoteIpValve) To: Tomcat Users List Content-Type: multipart/alternative; boundary="001a114204f2b9fda4055d131b16" archived-at: Fri, 03 Nov 2017 12:19:00 -0000 --001a114204f2b9fda4055d131b16 Content-Type: text/plain; charset="UTF-8" Hi, I am running a servlet and I get strange result for HttpServletRequest#getRemoteAddr(). I have configured RemoteIpValve which handles the X-Forwarded-For header and replaces the original IP address with the value contains in such header. I have an HttpServlet which dispacts the execution to a custom threadpool and uses request.startAsync() It seems that if I call getRemoteAddr on the original HttpServletRequest the value for getRemoteAddr() is correct, it contains the value of X-Forwarded-For header. When I call getRemoteAddr after calling startAsync() the result is the original IP address of the request. A workaround is to capture the IP Address early but I wonder if I am missing something, if it is an expected behavior or if I should file an issue. I am using tomcat 8.5.15 Thanks Enrico --001a114204f2b9fda4055d131b16--