Skip to main content
Tweeted twitter.com/StackDrupal/status/819943303391100928
edited tags
Link
4uk4
  • 101.7k
  • 7
  • 173
  • 217
Source Link
purencool
  • 541
  • 5
  • 25

Event Response not firing anonymous user

I have a module in drupal8 which only job is on an event response is to redirect a URL. It works fine for everyone except anonymous users. How do I give the module privileges to fire on every user no matter if the are logged in or not.

This is the geographic_me_redirect.services.yml

services:
  me_redirect.process_me_request:
    class: Drupal\me_redirect\EventSubscriber\ResponseSubscriber
    arguments: []
    tags:
      - { name: event_subscriber }

This is the response

class ResponseSubscriber implements EventSubscriberInterface
{


    /**
     * Constructor.
     */
    public function __construct()
    {

    }

    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents()
    {

        ///$events[KernelEvents::REQUEST][] = ['onRouteMatch', 27];
        //-- fires the event in the kernal early oo page load 20
        $events[KernelEvents::RESPONSE] = ['process_language_request',0];
        //-- For redirecting to another domain

        return $events;
    }



    public function process_language_request(FilterResponseEvent $event)
    {

    return my logic

    }
}