mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/17457] Allow bots but let reverse proxies know
PHPBB-17457
This commit is contained in:
parent
11b071f626
commit
0bf195c46f
1 changed files with 7 additions and 7 deletions
|
@ -15,9 +15,7 @@ namespace phpbb;
|
||||||
|
|
||||||
use phpbb\config\config;
|
use phpbb\config\config;
|
||||||
use phpbb\event\dispatcher_interface;
|
use phpbb\event\dispatcher_interface;
|
||||||
use phpbb\exception\http_exception;
|
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
|
|
||||||
class manifest
|
class manifest
|
||||||
{
|
{
|
||||||
|
@ -56,11 +54,6 @@ class manifest
|
||||||
*/
|
*/
|
||||||
public function handle(): JsonResponse
|
public function handle(): JsonResponse
|
||||||
{
|
{
|
||||||
if ($this->user->data['is_bot'])
|
|
||||||
{
|
|
||||||
throw new http_exception(Response::HTTP_FORBIDDEN, 'NO_AUTH_OPERATION');
|
|
||||||
}
|
|
||||||
|
|
||||||
$board_path = $this->config['force_server_vars'] ? $this->config['script_path'] : $this->path_helper->get_web_root_path();
|
$board_path = $this->config['force_server_vars'] ? $this->config['script_path'] : $this->path_helper->get_web_root_path();
|
||||||
|
|
||||||
$sitename = html_entity_decode($this->config['sitename'], ENT_QUOTES, 'UTF-8');
|
$sitename = html_entity_decode($this->config['sitename'], ENT_QUOTES, 'UTF-8');
|
||||||
|
@ -92,6 +85,13 @@ class manifest
|
||||||
$response->setPublic();
|
$response->setPublic();
|
||||||
$response->setMaxAge(3600);
|
$response->setMaxAge(3600);
|
||||||
$response->headers->addCacheControlDirective('must-revalidate', true);
|
$response->headers->addCacheControlDirective('must-revalidate', true);
|
||||||
|
|
||||||
|
if (!empty($this->user->data['is_bot']))
|
||||||
|
{
|
||||||
|
// Let reverse proxies know we detected a bot.
|
||||||
|
$response->headers->set('X-PHPBB-IS-BOT', 'yes');
|
||||||
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue