LoginSignup
9
9

More than 5 years have passed since last update.

phalcon でヘッダを追加する

Posted at

概要

phalcon で全体的にヘッダを追加したい場合について.

下記ツールなどで簡単にチェックしてみるとヘッダが付いてないとかいうアラートが出たりする.

OWASP Zed Attack Proxy Project - OWASP

https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project

じゃあつけましょうという話で DI に response で設定してしまう.

    $di['response'] = function() {
        $response = new \Phalcon\Http\Response();
        $response->setHeader('X-Frame-Options', 'SAMEORIGIN');
        $response->setHeader('X-Content-Type-Options', 'nosniff');
        return $response;
    };

終わり.

つけるヘッダなど

下記サイトなどを参考にスレばいいんじゃないかな.

今夜つける HTTPレスポンスヘッダー (セキュリティ編) - うさぎ文学日記

http://d.hatena.ne.jp/sen-u/20131130/p1

参考文献

ドキュメント

Returning Responses — Phalcon 1.3.0 documentation

http://docs.phalconphp.com/en/latest/reference/response.html

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9