M
M
mrWan2018-08-22 12:25:28
PHP
mrWan, 2018-08-22 12:25:28

How to protect against spoofed http headers?

I made my custom headers, threw a fictitious ip into them, on my server this fictitious ip was shown in the $_SERVER array, how can I protect myself from this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2018-08-22
@Sanasol

read IP not from headers...
Anything can be sent.
$_SERVER['REMOTE_ADDR'] is not taken from headers.

A
Alexander, 2018-08-22
@zkelo

If you send any custom header to the server, it is prefixed with HTTP_. For example, if you send a header REMOTE_ADDR, then in all scripts on your site, this header will be available as$_SERVER['HTTP_REMOTE_ADDR']
Это вывод ключей и значений массива $_SERVER. Как видно, переданный мной IP был записан в $_SERVER['HTTP_REMOTE_ADDR'], а настоящий IP записан, как полагается, в $_SERVER['REMOTE_ADDR']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question