K
K
korsamc2018-10-11 10:50:26
PHP
korsamc, 2018-10-11 10:50:26

How to implement 511 response from the server?

if($enable==0)
{
# сюда присылает неавторизированных пользователей файерволл
    if ($_SERVER['SERVER_NAME'] != "$servername.$domain_name")
    {
  
  header("location:http://$servername.$domain_name/index.php?add=" .
            urldecode($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']));
        exit;
    }

I know that the authorization header looks like this
header('HTTP/1.1 511 Network Authentication Required', TRUE, 511);

please tell me how
to implement it correctly so that unauthorized users are immediately automatically sent to captive portal detection?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2018-10-11
@korsamc

511 Network Authentication Required - this response is not sent by the server to which the request was intended, but by an intermediary server - for example, the provider's server - if the client must first log in to the network, for example, enter a password for a paid Internet access point. It is assumed that the body of the response will return a web authorization form or a redirect to it. Introduced in RFC 6585 Draft
try similar to 301

<?php 
 header("HTTP/1.1 511 Network Authentication Required "); 
 header("Location: http://www.host.ru"); 
 exit(); 
 ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question