W
W
w_b_x2018-02-12 14:04:19
PHP
w_b_x, 2018-02-12 14:04:19

How to make native basic http authorization?

Hello.
I make an HTTP-GET request, here it is (only the host is different):

'GET /cgi-bin/auth.cgi HTTP/1.1
Authorization: Basic cm9vdDpyb290
Host: example.ru
Accept: */*
Connection: close
Accept-Encoding: gzip, deflate

The Authorization header is formed like this:
Authorization: "Basic "+base64_encode("root:root")
In response, I get a 401 error:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>401 - Unauthorized</title>
 </head>
 <body>
  <h1>401 - Unauthorized</h1>
 </body>
</html>

Already tired.
What could be the problem and how to solve it?
ps through the browser I can easily log in, the password and login are correct

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2018-02-12
@Minifets

Maybe the problem is not in Authorization, but in other headers?
How is authorization implemented on the backend?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question