src/FlexApp/EventSubscriber/ImgLibSubscriber.php line 12

Open in your IDE?
  1. <?php
  2. namespace FlexApp\EventSubscriber;
  3. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  4. use Symfony\Component\HttpFoundation\RedirectResponse;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\HttpKernel\Event\RequestEvent;
  7. class ImgLibSubscriber implements EventSubscriberInterface
  8. {
  9.     public function onKernelRequest(RequestEvent $event)
  10.     {
  11.         $request $event->getRequest();
  12.         if ($request->getHost() === 'adm.tile.expert' && strpos($request->getPathInfo(), '/import') === 0) {
  13.             $redirectUrl 'https://aws-bi.tile.expert' $request->getRequestUri();
  14.             $event->setResponse(new RedirectResponse($redirectUrlResponse::HTTP_TEMPORARY_REDIRECT));
  15.         }
  16.     }
  17.     public static function getSubscribedEvents()
  18.     {
  19.         return [
  20.             RequestEvent::class => 'onKernelRequest',
  21.         ];
  22.     }
  23. }