title: Java EE Application response IP problem. Cached when the first client access the application
body: <p>I have a Java EE application deployed in Wildfly 18 that is accessed throw different proxys, so different users can access it using different IPs.
  When my application does a redirection, for example to the login page, it sends a status code 302 to the IP used by the client.
  The problem is that this IP is cached when the first client access the application and used for different clients. For example:</p>
  <p>CLIENT_1:</p>
  <p>1- Access the site like <a href="http://1.1.1.1:8080/MyApp" rel="nofollow noreferrer">http://1.1.1.1:8080/MyApp</a></p>
  <p>2- He is redirected to <a href="http://1.1.1.1:8080/MyApp/login" rel="nofollow noreferrer">http://1.1.1.1:8080/MyApp/login</a></p>
  <p>3- Successfully shows <a href="http://1.1.1.1:8080/MyApp/indexPage" rel="nofollow noreferrer">http://1.1.1.1:8080/MyApp/indexPage</a></p>
  <p>CLIENT_2:</p>
  <p>1- Access the site like <a href="http://2.2.2.2:8080/MyApp" rel="nofollow noreferrer">http://2.2.2.2:8080/MyApp</a></p>
  <p>2- He is redirected to <a href="http://2.2.2.2:8080/MyApp/login" rel="nofollow noreferrer">http://2.2.2.2:8080/MyApp/login</a></p>
  <p>3- When he login in, he is redirected to <a href="http://1.1.1.1:8080/MyApp/login" rel="nofollow noreferrer">http://1.1.1.1:8080/MyApp/login</a></p>
  <p>Cannot access login because user does know nothing about IP <strong>1.1.1.1.</strong></p>
  <p>In class <strong>AuthModule implements ServerAuthModule</strong> in method <em><strong>validateRequest</strong></em> i call <strong>authService.authenticate(username, password)</strong> and <strong>return AuthStatus.SUCCESS;</strong> if the authentication is correct.</p>