In Tomcat you can add
https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/valves/RemoteIpValve.html

Ср, 2 лист. 2016 о 13:51 Jonas Koperdraat <[email protected]> пише:

> Hi Zoran,
>
> I've checked and the proxy sets the 'X-Forwarded-Host' header and this
> contains the 'correct' host. The 'Host' header is also present on the
> request and this contains the hostname of the actual machine the servlet is
> running on. I'm not sure if we have the option to set it, but seeing as we
> already have the desired hostname available in de 'X-Forwarded-Host' option
> I'm not going to investigate that further ;-)
>
> But I guess our servlet container, which indeed is Tomcat, doesn't take the
> X-Forwarded-Host header into consideration when constructing the requestUrl
> parameter of the SerlvetRequest. So we'll have to manually insert the
> desired hostname into the request url.
>
> Kind regards,
>
> Jonas
>
> Op wo 2 nov. 2016 om 16:33 schreef Zoran Regvart <[email protected]>:
>
> > Hi Jonas,
> >
> > On Wed, Nov 2, 2016 at 4:25 PM, Jonas Koperdraat
> > <[email protected]> wrote:
> > > I don't know whether that header is being sent by the proxy. Should
> that
> > > impact the behavior I am seeing (e.g. should does that influence the
> > result
> > > of getRequestURL)?
> >
> > It does on some Servlet engines / middlewares, it might not in your
> > case, especially if you're using Tomcat.
> >
> > Another header that you might want to investigate is the `Host`
> > header, it's used for virtual hosts, and you might have an option to
> > set it in your proxy (on the request sent to the backend).
> >
> > zoran
> > --
> > Zoran Regvart
> > [email protected]
> >
>

Reply via email to