Jump to content

Custom response header from FrontController


lmikula
 Share

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 ?

 

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More