Security Hardening - Nginx Response Headers

On20th Jun 2021, 2022-12-01T08:00:00+05:30 Read Pause Resume Stop
Security Hardening - Nginx Response Headers

Now-a-days, web based attacks are one of the most common types of cybercrime, and in most cases, the attacked protocol is the HTTP, while the component that receives the attacks is the web server. Hardening Nginx HTTP headers becomes necessary for reducing any attacks to the web server.

And how to harden Nginx response HTTP headers? - HTTP headers are pieces of information that can be found when you interact with an HTTP server. These headers are among the most important parts of the HTTP request (made by HTTP clients, such as your web browser) and HTTP responses (made by HTTP servers such as Nginx).

Within these HTTP headers, one can identify how the request was processed by the web server, the type of HTTP status, and other data. There are two kinds of headers: those that are vulnerable, and those that are secure.

HTTP Header Vulnerable vs Secured..?

To note, the less information you expose on the Internet, the less data a penetration tester or real malicious attacker will find.

Let's look at two examples, a vulnerable HTTP header vs a hardened HTTP header.

1. Vulnerable HTTP Header example
$ curl -I http://drupal.localHTTP/1.1 200 OKServer: nginx/1.18.0Content-Type: text/html; charset=UTF-8

You can see a few headers vulnerable like, nginx server version is exposed as 1.18.0.

2. Hardened HTTP header example

Lets see the example of hardened headers below, where the server version is hidden & other headers like content-security-policy, x-frame-options etc are set.

$ curl -I https://www.drupal.orgHTTP/2 200server: nginxcontent-type: text/html; charset=utf-8x-drupal-cache: MISSx-ua-compatible: IE=edgefastly-restarts: 1x-content-type-options: nosniffx-frame-options: SAMEORIGINcontent-security-policy: frame-ancestors 'self'permissions-policy: interest-cohort=()strict-transport-security: max-age=15552000; includeSubDomains; preloadcontent-length: 100930

Tips to Secure & Harden HTTP Response Headers!

1. Hide PHP version

The PHP version can be disabled by altering PHP configuration i.e by modifying the expose_php variable from the php.ini file.

expose_php = Off

2. Hide Nginx server version

The server_tokens variable allows you to hide the nginx version in the response headers.

ServerTokens off

3. Enable Content Security Policy (CSP)

Content Security Policy defines which resources from your websites can be loaded by any remote web browser, including Javascript and CSS files.

Content-Security-Policy: default-src 'self' \*.drupal.local
Content-Security-Policy: script-src 'self' https://www.google-analytics.com

add_header Content-Security-Policy-Report-Only: "default-src 'self'; script-src *.drupal.local";

4. Enable HTTP Strict Transport Security

You can reduce the chances of becoming a victim to a man-in-the-middle attack by enabling HTTP Strict Transport Security.

server {    listen 443 ssl    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;}

5. Enable X-Content-Type-Options

You can ensure the browser will render the data as original, and not as any other by adding the X-Content-Type-Options.

add_header X-Content-Type-Options "nosniff" always;

6. Enable X-Frame-Options

In case, if Iframes are used then clickjacking attacks can be done, with this sensitive data from users can be stolen. So to reduce this risk, have the X-Frame-Options in headers.

add_header X-Frame-Options "SAMEORIGIN" always;

7. Enable Referrer Policy

Referrer Policy allows you to control what information can be included in the Referrer header while navigating from pages on your site. By doing this makes it impossible to track these requests while navigating away from your site.

add_header Referrer-Policy "origin-when-cross-origin" always;

8. Control Resources and Limits

To prevent potential DoS attacks on nginx, you can set buffer size limitations for all clients.

client_body_buffer_size 1kclient_header_buffer_size 1kclient_max_body_size 1klarge_client_header_buffers 2 1k

9. Configure SSL and Cipher Suites

Default configuration of nginx will use insecure old versions of the TLS protocol. This may lead to attacks such as the BEAST attack. So you can configure nginx to have TLSv1.2 or v1.3.

Additionally, you should specify cipher suites to make sure that no vulnerable suites are supported.

ssl_protocols TLSv1.2 TLSv1.3;ssl_prefer_server_ciphers on;

So, by having such response headers configured on the web server, we can make sure the website is not prone to vulnerabilities and be safe from attacks.

28,000OFF
LG 139 cm (55 inches) 4K Ultra HD Smart LED TV 55UR7500PSC (Dark Iron Gray)

LG 139 cm (55 inches) 4K Ultra HD Smart LED TV 55UR7500PSC (Dark Iron Gray)

43,990 71,990
Screen Size 55 Inches
Brand LG
Display Technology LED
Resolution 4K
Refresh Rate 60 Hz
Special Feature WebOS 23 with User Profiles | Filmmaker Mode, HDR 10 & HLG | Game Optimizer, ALLM, HGIG Mode | Unlimited OTT Apps | AI Brightness Control, 4K Upscaling & AI Sound (Virtual Surround 5.1 up-mix)WebOS 23 with User Profiles | Filmmaker Mode, HDR 10 & HLG | Game Optimizer, ALLM, HGIG Mode | Unlimited OTT Apps | AI Brightness Control, 4K… See more
Included Components 1 UHD 4K TV, 1 Warranty Card, 1 Remote Control, 2 Batteries, ‎‎1 Table Top Stand, 1 User Manual
Connectivity Technology Bluetooth, Wi-Fi, USB, HDMI
Aspect Ratio 16:9
Product Dimensions 23D x 123.5W x 78H Centimeters

Customers appreciate the TV's value for money and sound quality. They find the picture quality good, with realistic colors and AI-powered audio. However, some report issues with lags while using apps and loading videos. The remote control is not user-friendly and lacks bass. Opinions differ on installation ease and functionality.

Movies & TV
19,910OFF
Samsung 138 cm (55 inches) D Series Crystal 4K Vivid Ultra HD Smart LED TV UA55DUE70BKLXL (Black)

Samsung 138 cm (55 inches) D Series Crystal 4K Vivid Ultra HD Smart LED TV UA55DUE70BKLXL (Black)

44,990 64,900
Screen Size 55 Inches
Brand Samsung
Display Technology UHD
Resolution 4K
Refresh Rate 50 Hz
Special Feature Crystal Processor 4K | 4K Upscaling | UHD Dimming | Motion Xcelerator
Included Components 1 Unit TV, 1 Remote Control, 1 User Manual, 1 Power Cable
Connectivity Technology Wi-Fi, USB, Ethernet, HDMI
Aspect Ratio 16:9
Product Dimensions 6D x 123.4W x 71.1H Centimeters

Customers say: The TV has good quality, good picture quality, and is a good value for the price. However, some customers have reported issues with it not working, display issues, and mixed opinions on performance, sound quality, and color accuracy.

Movies & TV
16,500OFF
Mi 108 cm (43 inches) X Series 4K Ultra HD Smart Google TV L43M8-A2IN (Black)

Mi 108 cm (43 inches) X Series 4K Ultra HD Smart Google TV L43M8-A2IN (Black)

26,499 42,999
Screen Size 43 Inches
Brand Mi
Display Technology LED
Resolution 4K
Refresh Rate 60 Hz
Special Feature 4K Dolby Vision | Hey Google | Google TV | HDR 10 | HLG | Wide Color Gamut | Supported Applications : PatchWall, Netflix, Amazon Prime Video, Disney+ Hotstar, Miracast, Media player, Gallery, TV Manager, User Manual, Live TV, YouTube, YouTube Music, Play Store4K Dolby Vision | Hey Google | Google TV | HDR 10 | HLG | Wide Color Gamut | Supported Applications : PatchWall, Netflix, Amazon Prime Video, Disney+… See more
Included Components 1 LED TV, 2 Table Stand Base along with screws, 1 User Manual, 1 Warranty Card, 1 Remote Control, 2 AAA Battery1 LED TV, 2 Table Stand Base along with screws, 1 User Manual, 1 Warranty Card, 1 Remote Control, 2 AAA Battery
Connectivity Technology Wi-Fi, USB, Ethernet
Product Dimensions 24.1D x 95.7W x 61.2H Centimeters
Supported Internet Services Netflix, Amazon Prime Video, PatchWall, Miracast, Disney+ Hotstar

The television has good quality, good picture quality, and a good balance of picture and sound quality. Customers find it a good value for money. However, some have reported issues with the remote not working or the display switching on and off. There are also complaints about poor connectivity options and WiFi connectivity issues.

Movies & TV

Related Articles

90,000OFF
OnePlus 163 cm (65 inches) Q Series 4K Ultra HD QLED Smart Google TV 65 Q2 Pro (Black)

OnePlus 163 cm (65 inches) Q Series 4K Ultra HD QLED Smart Google TV 65 Q2 Pro (Black)

69,999 1,59,999
Screen Size 65 Inches
Brand OnePlus
Display Technology QLED
Resolution 4K
Refresh Rate 120 Hz
Special Feature QLED TV | Speak Now™ Hands-free voice control | Remote With Voice Assistant | Google TV | HDR 10+|Dolby Vision | DCI-P3 97% Wide Color Gamut | Supported Applications : Netflix, Disney+Hotstar, YoutubeQLED TV | Speak Now™ Hands-free voice control | Remote With Voice Assistant | Google TV | HDR 10+|Dolby Vision | DCI-P3 97%
Included Components 1 LED TV, 2 Table Stand Base, 1 User Manual, 1 Warranty Card, 1 Remote Control,1 AV IN Adapter, 1AC Cord, 2 AAA Battery1 LED TV, 2 Table Stand Base, 1 User Manual, 1 Warranty Card, 1 Remote Control,1 AV IN Adapter, 1AC Cord, 2 AAA Battery
Connectivity Technology Wi-Fi, USB, Ethernet, HDMI
Aspect Ratio 1.78:1
Product Dimensions 9.2D x 145W x 88.2H Centimeters

Customers appreciate the TV's sound quality and quality. They find it easy to install and like the vivid colors. However, opinions differ on picture quality, value for money, and responsiveness.

Movies & TV

Recent Articles

Recent Quick Read

Recent Great People

19,000OFF
Redmi 108 cm (43 inches) F Series 4K Ultra HD Smart LED Fire TV L43R8-FVIN (Black)

Redmi 108 cm (43 inches) F Series 4K Ultra HD Smart LED Fire TV L43R8-FVIN (Black)

23,999 42,999
Screen Size 43 Inches
Brand Redmi
Display Technology LED
Resolution 4K
Refresh Rate 60 Hz
Special Feature Fire TV Built-In | Redmi Voice Remote with Alexa | Prime Video, Netflix, Disney+ Hotstar, YouTube, Jio Cinema, Sony LIV and 12000+ apps from Fire TV Appstore | Set-top-box Live TV Integration to switch between DTH TV channels and OTT apps seamlessly by just asking Alexa | Picture-in-Picture mode | Display Mirroring – Apple Airplay 2 & Miracast | Smart Home Dashboard | 2GB RAM + 8GB Storage | Metal Bezel-less DesignFire TV Built-In | Redmi Voice Remote with Alexa | Prime Video, Netflix, Disney+ Hotstar, YouTube, Jio Cinema, Sony LIV and 12000+ apps from Fire TV Appstore | Set-top-box… See more
Included Components 1 LED TV, 1 Remote Control, 1 Manual, 2 Stands Unit, 4 Screws, 2 x AAA batteries
Connectivity Technology Wi-Fi, USB, Ethernet, HDMI
Aspect Ratio 16:9
Product Dimensions 24.1D x 95.7W x 60.7H Centimeters

The screen is really good, however viewing angles are not so good. Speakers are decent and I didn't feel any need for external speakers. Remote is amazing, I love the alexa support. Fire TV OS is also faster than android and I prefer it however it mainly shows amazon apps suggestions which I don't like much. One thing that could be improved is the 8GB storage out of which we only get 1-2GB free.

For my preferences this TV stood out and has delivered pretty good as well. For me it a value for money deal and I'm happy with the purchase so far. Let's see how long it lasts as the ultimate test for it would be of durability. If it lasts next 7-8 years it would be a complete paisa vasool product for me.

Home Appliances
8,000OFF
LG 80 cm (32 inches) HD Ready Smart LED TV 32LM563BPTC (Dark Iron Gray)

LG 80 cm (32 inches) HD Ready Smart LED TV 32LM563BPTC (Dark Iron Gray)

13,990 21,990
Screen Size 32 Inches
Brand LG
Display Technology LED
Resolution 720p
Refresh Rate 60 Hz
Special Feature Flat
Included Components 1 LED TV, 1 Table Top Stand, 1 User Manual, 1 Warranty Card, 1 Remote Control, 2 AAA Batteries
Connectivity Technology Wi-Fi
Aspect Ratio 16:9
Product Dimensions 3.3D x 20.1W x 17.4H Centimeters
  • Resolution: HD Ready (1366x768) | Refresh Rate: 60 hertz
  • Connectivity: 2 HDMI ports to connect set top box, Blu Ray players, gaming console | 1 USB ports to connect hard drives and other USB devices
  • Sound output: 10 Watts Output I 2 Speakers | DTS Virtual:X | Sound Type : Down FiringSmart
  • TV Features: Web OS Smart TV | Wi-Fi | Home Dashboard | Screen Mirroring | Mini TV Browser | Multi-Tasking | Office 365, Set WXHXD (with Stand ) mm - 739 x 472 x 168Display: Active HDR | Display Type: Flat | BackLight Module: Slim LED
Movies & TV
5,000OFF
OPPO F27 Pro+ 5G (Midnight Navy, 8GB RAM, 256GB Storage) | 6.7

OPPO F27 Pro+ 5G (Midnight Navy, 8GB RAM, 256GB Storage) | 6.7" FHD+ AMOLED Toughest 3D Curved Display|64MP AI Featured Camera|IP69 | 67W SUPERVOOC| with No Cost EMI/Additional Exchange Offers

29,999 34,999
  • DISPLAY : 17.02cm (6.7"Inch) AMOLED 3D Curved Display with Screen-to-body ratio: 93% .FHD+ Resolution with 2412×1080 Pixels , with 1Billion Colours and 120Hz Refresh Rate.
  • CAMERA : Dual Ultra-Clear Camera 64MP Main Camera + 2MP Portrait camera |8MP Front Selfie Camera| AI Portrait Retouching |AI Eraser|AI Smart Image Matting features
  • MEMORY STORAGE,SIM & PROCESSOR : 8 GB RAM|256 GB ROM | Dual 5G Sim Slot |Latest Android 14 Operating System and ColorOS 14.0 System Platform with MediaTek Dimensity 7050.
  • FAST CHARGING & BATTERY : 67W SuperVOOC charging enable full charging in 44Mins .It have 5000mAh durable long Battery .
  • TOUGHEST 3D CURVED SCREEN & PREMIUM DESIGN :All-Round Armor Impact Resistant Structure with Screen Protected by corning gorilla Glass Victus 2.Cosmos Ring design has been adopted to showcase a classic style of beauty featuring inclusiveness and orderliness. The elegant circular panel looks unique and eye-catching.Premium back leather design with stain resistance
Mobiles & Accessories
19,000OFF
Aspire Lite AMD Ryzen 3 5300U Premium Thin and Light Laptop (Windows 11 Home/8 GB RAM/512 GB SSD) AL15-41 with 39.62 cm (15.6

Aspire Lite AMD Ryzen 3 5300U Premium Thin and Light Laptop (Windows 11 Home/8 GB RAM/512 GB SSD) AL15-41 with 39.62 cm (15.6") Full HD Display, Metal Body, Steel Gray, 1.6 KG

28,990 47,990

About this item

  • Processor: AMD Ryzen 3 5300U Quad-Core Mobile Processor with AMD Radeon Graphics.Maximum Power Supply Wattage 65 W
  • Visibly Stunning: Experience sharp details and crisp colors on the 15.6" Full HD display, 16:9 aspect ratio, ultra-slim design and narrow bezels.
  • Internal Specifications: RAM - 8 GB of Dual-channel DDR4, 2 SODIMM sockets; Storage - 512 GB SSD NVMe solid-state drive storage (expandable up to 1TB) to store your files and media
  • Ports: 1 x USB 3.2 Gen 1 (Type A), 2 x USB 2.0 (Type A), 1 x USB 3.2 Gen 2 (Type C), 1 x DC-in jack
  • Keyboard: 100-/101-/104-key keyboard with independent numeric keypad, international language support
Mobiles & Accessories
We Need Your Consent
By clicking “Accept Cookies”, you agree to the storing of cookies on your device to enhance your site navigation experience.
I Accept Cookies