Skip to content

Conversation

tt
Copy link
Contributor

@tt tt commented Jun 17, 2018

In elixir-plug/plug@d24ba4f, the peer field got replaced with a get_peer_data function.

This makes the package require Plug 1.6.0 and uses this new function to resolve the remote port.

Copy link
Contributor

@mitchellhenke mitchellhenke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this!

I'll probably hold off on merging this until after I do another release as restricting to these versions of Plug may have an impact on existing users.

mix.exs Outdated
{:uuid, "~> 1.0"},
{:poison, "~> 1.5 or ~> 2.0 or ~> 3.0"},
{:plug, "~> 1.0", optional: true},
{:plug, ">= 1.6.0 and < 2.0.0", optional: true},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change this to ~> 1.6? I think that would be equivalent to the above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought ~> 1.6 meant ">= 1.6 and < 1.7" but that's incorrect. I'll address it.

Copy link
Contributor

@mitchellhenke mitchellhenke Jun 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, thanks for addressing it!

If it's helpful, https://hexdocs.pm/elixir/Version.html has an explanation of the version locking rules

@mitchellhenke mitchellhenke merged commit 390dfed into getsentry:master Jun 26, 2018
@mitchellhenke
Copy link
Contributor

@tt Thanks again for opening this PR! 💖 💖 💖 💖

@stevedomin
Copy link
Contributor

@mitchellhenke I don't think the library should use the peer's port as the remote port. With today's architectures this is often going to be wrong. Might be best to skip it.

@mitchellhenke
Copy link
Contributor

@stevedomin This is an area I'm not overly familiar with, so if you don't mind I have a few questions. Is there something that would be more correct? Or it's not feasible to do that, and the current port information isn't super valuable, and should be removed?

Any links to information on the topic would also be greatly appreciated if that exists. 🙂

@stevedomin
Copy link
Contributor

@mitchellhenke sure.

If your application is behind a load-balancer/proxy the X-Forwarded-Port header will sometimes be set (AWS does this I believe). The Forwarded header can also contain port information of the nodes (but it's not guaranteed).

Despite this I still think it might be best to remove it completely. It's not going to be set often enough that it is useful and having the peer port is not super valuable.

@tt tt deleted the use-get-peer-data-function branch August 15, 2018 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants