-
Notifications
You must be signed in to change notification settings - Fork 56
Conversation
Hi, @Overtorment thanks for your contribution. |
@oscarotero thats what I thought too, but I deployed to https://heroku.com/ and got the wrong IP |
hmmm. worth doublechecking, maybe smth to do with the order of headers... |
|
ok, found the issue:
@oscarotero how would you advise to fix that? Ill prepare a PR |
2e5cfa2
to
a6241d6
Compare
Ok, I see. |
@oscarotero I have just rearranged code so that |
Your solution is not valid, because only cover your needs. |
I preffer to create a new PR for this. |
7d2217c
to
f878e8e
Compare
Okay, I think its the best and simplest solution. Litterally no code written, just moved a bit. |
@oscarotero I rebased it to 1 commit to keep git history tidy |
Ok, I'm ok with this but there's one more thing: Middlewares::clientIp(); //trust in REMOTE_ADDR
Middlewares::clientIp()->headers(); //Use the headers before
Middlewares::clientIp()->headers(['X-Forwarded']); //Use just this header before, instead all The only change is empty the headers array and add it as the default value of headers method: public function headers (array $headers = ['Forwarded', 'Forwarded-For', 'Client-Ip', 'X-Forwarded', 'X-Forwarded-For', 'X-Cluster-Client-Ip']) {
$this->headers = $headers;
return $this;
} |
f878e8e
to
438346e
Compare
@oscarotero fixed. Unit test as well |
Thank you |
On Heroku ip wasnt detected correctly. Thats a fix.