Last active
November 4, 2019 16:39
-
-
Save Kaapiii/e63140f0eff20f2e04c3dba35980913b to your computer and use it in GitHub Desktop.
Test for Concrete5 ApiLoggerMiddleware
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Concrete\Core\Http\Middleware; | |
use Concrete\Core\Logging\Channels; | |
use Concrete\Core\Logging\LoggerAwareInterface; | |
use Concrete\Core\Logging\LoggerAwareTrait; | |
use Psr\Log\LoggerInterface; | |
use Symfony\Component\HttpFoundation\Request; | |
class ApiLoggerMiddleware implements MiddlewareInterface, LoggerAwareInterface | |
{ | |
use LoggerAwareTrait; | |
/** | |
* @var LoggerInterface | |
*/ | |
protected $logger; | |
/** | |
* ApiLoggerMiddleware constructor. | |
* @param LoggerInterface $logger | |
*/ | |
public function __construct(LoggerInterface $logger) | |
{ | |
$this->logger = $logger; | |
} | |
/** | |
* @return string | |
*/ | |
public function getLoggerChannel() | |
{ | |
return Channels::CHANNEL_API; | |
} | |
/** | |
* Process the request and return a response | |
* @param \Symfony\Component\HttpFoundation\Request $request | |
* @param DelegateInterface $frame | |
* @return \Symfony\Component\HttpFoundation\Response | |
*/ | |
public function process(Request $request, DelegateInterface $frame) | |
{ | |
$this->logger->debug($request->headers); | |
return $frame->next($request); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# forward Authorization headers on revers proxy | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
proxy_set_header Authorization $http_authorization; | |
proxy_pass_header Authorization; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment