Jump to content

Custom response header from FrontController


lmikula

Recommended Posts

Hello,

 

   where would be the best way to place code to add custom response header to all front pages ?

Currently I do it in:

override/controllers/FrontController.php

Where i override the initHeader() function like this:

        public function initHeader()
        {
                parent::initHeader();

		if ($this->context->customer->isLogged())
		{
			/** some more logic **/

			header('X-PS-CustomHeader: some_value');
		}
        }

It works as expected (at least from a brief test)...

 

My question is: Is this the right procedure or is there a better/more appropriate way to achieve this ?

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...