Welcome Guest, Not a member yet? Register   Sign In
Correct Place to Set Global HTTP Headers?
#1

(This post was last modified: 11-26-2018, 06:02 AM by Haravikk.)

I'm trying to set the Strict-Transport-Security (HSTS) HTTP header for a site built using CodeIgniter, but because it's hosted using Google App Engine the only way to set the headers is in the application itself (you can only set custom headers for static content in the app.yaml configuration file).

What I'm wondering is, where would be the best place to put custom site-wide HTTP headers? I have a whole bunch of controllers so putting it in all of these isn't an option, and putting it in my header view doesn't seem like best practice (I also have a few variants, so I'd prefer not to have to edit them all).

Is there a good place to put custom HTTP headers that I want to appear in all responses from my site? My first thought was to create a helper and just use PHP's own header() function (as I don't think the Output class is available to global code in helpers?), but I'm curious if anyone can think of a better place to do this?
Reply


Messages In This Thread
Correct Place to Set Global HTTP Headers? - by Haravikk - 11-26-2018, 06:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB