• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

How do I set headers ?

Scheduled Pinned Locked Moved Cache/Proxy
7 Posts 2 Posters 2.1k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    Actionhenk
    last edited by Oct 7, 2019, 6:08 PM

    Hi,
    I have ran a few testers on the web and the tests are reporting im missing a few headers and need them to improve security.

    I tried adding headers using an action on the main ha frontend like below

    498a5e54-6fa3-40c8-b2ac-cf0d87a3736b-image.png

    After applying settings Im getting an error about the option needing exactly 2 arguments .. How should I set such headers and where ? Straight in the config (wouldnt this be overwritten by ha-proxy ?)?

    Thanks!

    1 Reply Last reply Reply Quote 0
    • D
      Derelict LAYER 8 Netgate
      last edited by Oct 7, 2019, 6:21 PM

      You probably want to set http response headers, not request headers.

      Chattanooga, Tennessee, USA
      A comprehensive network diagram is worth 10,000 words and 15 conference calls.
      DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
      Do Not Chat For Help! NO_WAN_EGRESS(TM)

      1 Reply Last reply Reply Quote 0
      • A
        Actionhenk
        last edited by Oct 7, 2019, 6:28 PM

        allright thanks, I will change it to request. So this is the correct place/way to put in the headers ? How would I configure this header:

        Content-Security-Policy: default-src https: data: 'unsafe-inline' 'unsafe-eval'
        

        The value contains spaces, so haproxy interface on pfsense wont accept it. I get the error it needs 2 arguments ?

        Thanks!

        1 Reply Last reply Reply Quote 0
        • D
          Derelict LAYER 8 Netgate
          last edited by Derelict Oct 7, 2019, 6:41 PM Oct 7, 2019, 6:36 PM

          Something like this.

          Screen Shot 2019-10-07 at 11.34.25 AM.png

          All I did was enclose everything in double quotes. Ended up with this:

          http-response set-header Content-Security-Policy "default-src https: data: 'unsafe-inline' 'unsafe-eval'"  if  yourAcl
          

          I didn't test it.

          Chattanooga, Tennessee, USA
          A comprehensive network diagram is worth 10,000 words and 15 conference calls.
          DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
          Do Not Chat For Help! NO_WAN_EGRESS(TM)

          1 Reply Last reply Reply Quote 1
          • A
            Actionhenk
            last edited by Oct 7, 2019, 6:39 PM

            Cool! thanks, will test this and see if it works.

            1 Reply Last reply Reply Quote 0
            • A
              Actionhenk
              last edited by Oct 7, 2019, 6:54 PM

              nice, it seems to work, getting A+ result now !

              D 1 Reply Last reply Oct 7, 2019, 6:57 PM Reply Quote 1
              • D
                Derelict LAYER 8 Netgate @Actionhenk
                last edited by Oct 7, 2019, 6:57 PM

                @Actionhenk Nice. One other thing: I haven't looked at it but I assume if you need double quotes in a string like that in the future you can just escape the ones inside the string with \"

                Chattanooga, Tennessee, USA
                A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                Do Not Chat For Help! NO_WAN_EGRESS(TM)

                1 Reply Last reply Reply Quote 0
                1 out of 7
                • First post
                  1/7
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                  This community forum collects and processes your personal information.
                  consent.not_received