그래서 서버 애플리케이션에 서버가 있습니다. 서버 1의 PHP 스크립트 인 도메인 1은 페이지에 사용자 정의 헤더를 설정합니다 (권한 부여 : Bearer 123456789). 서버 2의 스크립트 인 도메인 2는 get_headers()를 사용하여 헤더를 읽습니다.Joomla가 맞춤 헤더를 보내지 않음
파일이 원래 처리 될 때 모두 정상적으로 작동합니다. 그러나 서버 1의 스크립트가 Joomla 모듈에 포함되어있을 때 get_headers()는 사용자 정의 헤더를 검색하지 않습니다.
두 경우 모두 개발자 도구는 맞춤 헤더뿐만 아니라 get_headers()가 반환 한 헤더와 다른 헤더를 표시합니다.
아래 코드는 Joomla가로드 된 경우 JFactory를 사용하여 헤더를 설정하지만 header()를 사용하는 경우와 동일한 결과입니다. Joomla가 사용자 정의 헤더를 전달하지 않습니다.
나는 그것을 얻지 않는다. 누구가 여기에서 무슨 일이 일어나고 있는지 알 수 있습니까? SEF 또는 htaccess 문제가 아닙니다.
<?php
// Server 1
if(!class_exists("JFactory")){ // no Joomla
header('Authorization: Bearer 123456789');
} else { // Joomla framework loaded
$app = JFactory::getApplication();
$app->setHeader('Authorization: ', 'Bearer 123456789');
$app->sendHeaders();
}
서버 2의 코드 : get_headers에서
<?php
// Server 2
$headers = get_headers("http://server1.com/");
foreach($headers as $header) {
echo $header ."<br/>";
}
출력() 기본적으로 제공하는 경우 :
HTTP/1.1 200 OK Date: Thu, 19 Jan 2017 12:44:35 GMT Server: Apache Authorization: Bearer 123456789 Content-Length: 0 Connection: close Content-Type: text/html
출력 get_headers에서() 줌라에 의해 제공 할 때 :
HTTP/1.1 200 OK Date: Thu, 19 Jan 2017 12:45:49 GMT Server: Apache Set-Cookie: 3c460b3da9ecb202e794816b4144c6ff=ja7mn4b4njov98lsv76kk8pvu2; path=/; HttpOnly Vary: Accept-Encoding Content-Length: 1264 Connection: close Content-Type: text/html
Authorization: Bearer 123456789 Date: Thu, 19 Jan 2017 13:07:32 GMT Server: Apache Connection: Keep-Alive Keep-Alive: timeout=5, max=100 Content-Length: 0 Content-Type: text/html 200 OK
의 Joomla 헤더 : 개발자 도구에 의해 표시 3,516,
기본 헤더
Pragma: no-cache Date: Thu, 19 Jan 2017 12:19:24 GMT Last-Modified: Thu, 19 Jan 2017 12:19:25 GMT Server: Apache Authorization: : Bearer 123456789 Vary: Accept-Encoding Content-Type: text/html; charset=utf-8 Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection: Keep-Alive Keep-Alive: timeout=5, max=100 Content-Length: 76888 Expires: Wed, 17 Aug 2005 00:00:00 GMT