Closed crustamet closed 4 years ago
Imho It is correct. What if server has many up addresses or ip4 and ipv6 addresses?
On Wed, Aug 19, 2020, 10:23 Merlas Paul (Crustamet) < notifications@github.com> wrote:
i save all my requests into a table of database, i found out that the cronjobs that run on my system the ip address is 0.0.0.0 it should be the ip of the server right ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/codeigniter4/CodeIgniter4/issues/3512, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAGMUS3YYHMGYGRO4OPI2DSBODXNANCNFSM4QEVPO5Q .
@michalsn This was a retorical question, did you even read the title ?
This is a BUG. Steps to recreate is when using the command line the Request Class from the codeigniter RETURNS the ip_address 0.0.0.0
It should be the IP of the Server.
Yes, my bad - sorry about that.
For future reference - if possible, please use our template to report bugs. It will help a lot.
I think this is not a framework issue so much as a server configuration. Check the value of $_SERVER['REMOTE_ADDR']
and you will see that it varies between implementations. Since we're talking about a Request
it might be possible to force this value under CLI execution to something meaningful (like 127.0.0.1) but I don't know of that is any better than the current behavior.
@MGatner you are right 127.0.0.1 is the same as being 0.0.0.0
i really need the real ip of the request, even if it was made from cli.
i understand it varies but we know when the request is from cli we can put the ip of the srv.
You telling me that we cannot get the ip of the server when using CLI ?
Something like
gethostbyname(gethostname())
this returns the ip
Sorry for closing and reopen i missed clicked
I understand your interest, I'm saying my opinion is that this is not appropriate for the framework and it is something that you should handle in your project. If you get an IP of 0.0.0.0
then you replace it with the code you used.
IP addresses are not a straightforward conversion, so making those assumptions builds in some undesired logic.
k i understand. thanks. maybe in the future who got the same for cli request will be able to extend it somehow and change the request class with the ip address
i save all my requests into a table of database, i found out that the cronjobs that run on my system the ip address is 0.0.0.0 it should be the ip of the server right ?