doubi2145 2017-02-20 02:13
浏览 151

X-Frame-Options标头未在Laravel Web应用程序中设置

I've started building an ecommerce website using Laravel, and now I'm starting to become more concerned with the security side of things, when I start building the payment processing page.

I stumbled upon a bunch of headers I was missing and decided to add the proper ones. I added headers to all my links using a middleware called "Secure":

public function handle($request, Closure $next)
{
    $response = $next($request);

    $response->withHeaders([
        'X-Frame-Options' => 'DENY',
        'X-XSS-Protection' => '1; mode=block',
        'X-Permitted-Cross-Domain-Policies' => 'master-only',
        'X-Content-Type-Options' => 'nosniff',
        'Referrer-Policy' => 'no-referrer-when-downgrade',
        'Strict-Transport-Security' => 'max-age=31536000; includeSubDomains',
        'Cache-Control' => 'no-cache, no-store, must-revalidate, post-check=0, pre-check=0',
        'Pragma' => 'no-cache',
        'Expires' => 'Sat, 26 Jul 1997 05:00:00 GMT',
        ]);

    return $response;
}

Then I just route group all the links I want with these headers in the web.php file. Now all the other headers are showing up:

HTTP/1.1 200 OK
date: Mon, 20 Feb 2017 01:58:50 GMT
server: Apache/2.4.7 (Ubuntu)
cache-control: must-revalidate, no-cache, no-store, post-check=0, pre-check=0, private
x-xss-protection: 1; mode=block
x-permitted-cross-domain-policies: master-only
x-content-type-options: nosniff
referrer-policy: no-referrer-when-downgrade
strict-transport-security: max-age=31536000; includeSubDomains
pragma: no-cache
expires: Sat, 26 Jul 1997 05:00:00 GMT

This is part of the header response and none of the response includes the X-Frame-Options, but does include the others. Even when I put my website through a header scanning site like securityheaders.io they detect it as a missing header. I was wondering what I could do to fix this, or if it is even an issue?

I should mention I've tried using the php header() function to similar results. Maybe something is deleting the X-Frame-Options header?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 linux驱动,linux应用,多线程
    • ¥20 我要一个分身加定位两个功能的安卓app
    • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
    • ¥15 IAR程序莫名变量多重定义
    • ¥15 (标签-UDP|关键词-client)
    • ¥15 关于库卡officelite无法与虚拟机通讯的问题
    • ¥15 目标检测项目无法读取视频
    • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
    • ¥100 求采集电商背景音乐的方法
    • ¥15 数学建模竞赛求指导帮助