fix: ip
This commit is contained in:
@@ -124,6 +124,25 @@ class PageVisitTest extends TestCase
|
||||
$this->assertSame('203.0.113.50', $row->ip);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function hit_prefers_cf_connecting_ip_over_x_forwarded_for(): void
|
||||
{
|
||||
Cache::flush();
|
||||
|
||||
$this->call('GET', '/statistic/t', [
|
||||
'c' => self::CHANNEL,
|
||||
'u' => '11111111-2222-4333-8444-555555555555',
|
||||
], [], [], [
|
||||
'REMOTE_ADDR' => '104.16.1.1',
|
||||
'HTTP_X_FORWARDED_FOR' => '1.2.3.4',
|
||||
'HTTP_CF_CONNECTING_IP' => '203.0.113.88',
|
||||
])->assertOk();
|
||||
|
||||
$row = PageVisit::query()->first();
|
||||
$this->assertNotNull($row);
|
||||
$this->assertSame('203.0.113.88', $row->ip);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function hit_stores_cf_ipcountry(): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user