[Koha-bugs] [Bug 17050] Accessing the REST API through Plack kicks the session out
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Aug 19 20:12:03 CEST 2016
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17050
--- Comment #13 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
Created attachment 54656
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54656&action=edit
Bug 17050: (QA followup) Use Mojo::Transaction to get the remote address
While the original patch fixes the issue, reading at Mojolicious source code,
revealed
that Mojo::Transaction already has proper processing for detecting the remote
address:
sub remote_address {
my $self = shift;
return $self->original_remote_address(@_) if @_;
return $self->original_remote_address unless $self->req->reverse_proxy;
# Reverse proxy
return ($self->req->headers->header('X-Forwarded-For') // '') =~ /([^,\s]+)$/
? $1
: $self->original_remote_address;
}
Without this patch, if there's a request without HTTP_X_FORWARDED_FOR, then the
remote
address would be empty. Such would be the case of a dev/standard setup without
Plack.
This patch makes Koha::REST::V1::startup use tx->remote_address instead of
dealing with the
headers on its own.
Signed-off-by: Tomas Cohen Arazi <tomascohen at theke.io>
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list