Giter Site home page Giter Site logo

Comments (5)

takezoe avatar takezoe commented on May 28, 2024 1

I think even Scalatra 2.8 won't be released within a short time frame. Changing it in Scalatra 2.8 might be acceptable.

from scalatra.

takezoe avatar takezoe commented on May 28, 2024 1

OK, let's add remoteAddresses anyway in 2.7.2.

Sorry, I was being confused by the specification of remoteAddress. It says:

  /**
   * The remote address the client is connected from.
   * This takes the load balancing header X-Forwarded-For into account
   * @return the client ip address
   */

I thought we should keep the current behavior for users who use this method to get a complete X-Forwarded-For header. However, they should refer to the request header directly in that case. I think we can fix remoteAddresses even in 2.7.2 because this is a bug.

from scalatra.

takezoe avatar takezoe commented on May 28, 2024

Hm, that is perhaps right. However, that will be incompatible change. I'm considering adding new method which returns X-FORWARDED-FOR header value as it is (comma-separated multiple addresses) and deprecate the current remoteAddress. In addition, remoteAddresses: Seq[String] can be added.

What do you think of this idea?

from scalatra.

magnolia-k avatar magnolia-k commented on May 28, 2024

The current remoteAddress method will return the result of the getRemoteAddr method if X-FORWARDED-FOR is not specified.

The method itself that does this behavior is useful and necessary.

Adding a new method is one idea, but since the current behavior itself is wrong (multiple IP addresses are returned as a single String when X-FORWARDED-FOR is specified), I think we can incorporate it as an incompatible change in a major version upgrade ( Scalatra 3.0?)

Translated with www.DeepL.com/Translator (free version)

from scalatra.

JustAHappyKid avatar JustAHappyKid commented on May 28, 2024

@takezoe, I think your recommendation (add remoteAddresses method) is a big improvement over the current situation.

Having remoteAddress return something that is not a valid IP address is a bit of a land-mine. In our case, we were attempting to store it in a "clicks" table, and the only reason I noticed the issue was because we occasionally get a user with two IPs in X-Forwarded-For, leading to a database exception.

from scalatra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.