```
✨ feat(caddy): Ajoute l'exclusion d'indexation pour certains hôtes et améliore les headers. ➕ feat(security): Crée un listener pour rediriger la racine de reservation.ludikevent.fr. ```
This commit is contained in:
@@ -10,9 +10,13 @@ intranet.ludikevent.fr, signature.ludikevent.fr, reservation.ludikevent.fr {
|
||||
max_size 100MB
|
||||
}
|
||||
|
||||
# --- NO-INDEX MATCHER ---
|
||||
# Defines which hosts should not be indexed
|
||||
@noindex host intranet.ludikevent.fr signature.ludikevent.fr
|
||||
header @noindex X-Robots-Tag "noindex, nofollow"
|
||||
|
||||
# --- BLOC HEADER AVEC CSP ---
|
||||
header {
|
||||
X-Robots-Tag "noindex, nofollow, nosnippet, noarchive"
|
||||
X-Content-Type-Options "nosniff"
|
||||
X-Frame-Options "DENY"
|
||||
Referrer-Policy "strict-origin-when-cross-origin"
|
||||
|
||||
37
src/Security/RedirecListener.php
Normal file
37
src/Security/RedirecListener.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Security;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
||||
use Symfony\Component\HttpKernel\Event\ResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Twig\Environment;
|
||||
|
||||
#[AsEventListener(event: ResponseEvent::class,method: 'onResponse')]
|
||||
class RedirecListener
|
||||
{
|
||||
private Environment $twig;
|
||||
|
||||
public function __construct(Environment $twig)
|
||||
{
|
||||
$this->twig = $twig;
|
||||
}
|
||||
|
||||
public function onResponse(ResponseEvent $event): void
|
||||
{
|
||||
$request = $event->getRequest();
|
||||
if($request->getPathInfo() == "/") {
|
||||
if($request->getHost() =="reservation.ludikevent.fr"){
|
||||
$redirect = new RedirectResponse("https://reservation.ludikevent.fr/revervation");
|
||||
$event->setResponse($redirect);
|
||||
$event->stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user