Skip to content

Commit 4b68d3d

Browse files
committed
- updating the security of PHP headers
Issue: #2795 - adding missing security headers Issue: #2796
1 parent e0010a2 commit 4b68d3d

4 files changed

Lines changed: 14 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## 2026-04-16
2+
3+
- Hardened HTTP response headers: set `expose_php = Off` in `etc/php.ini` to suppress the `X-Powered-By: PHP/x.x.x` header, added `Header always unset X-Powered-By` to `etc/apache-vhost.conf` as a belt-and-suspenders removal at the Apache level, and added five standard security headers (`X-Content-Type-Options`, `X-Frame-Options`, `Referrer-Policy`, `X-XSS-Protection`, `Permissions-Policy`) to the same vhost config. Enabled `mod_headers` unconditionally in `Dockerfile` to support all of the above.
4+
5+
References: https://github.com/proudcity/wp-proudcity/issues/2795
6+
References: https://github.com/proudcity/wp-proudcity/issues/2796

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RUN apt-get update \
2020
&& rm -rf /var/lib/apt/lists/* \
2121
&& docker-php-ext-configure gd --with-jpeg \
2222
&& docker-php-ext-install gd mysqli opcache bcmath \
23-
&& a2enmod rewrite expires
23+
&& a2enmod rewrite expires headers
2424

2525
RUN pecl install mcrypt-1.0.6
2626

etc/apache-vhost.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
#ServerName www.example.com
33
#ServerAdmin webmaster@localhost
44
DocumentRoot /app/wordpress
5+
Header always unset X-Powered-By
6+
Header always set X-Content-Type-Options "nosniff"
7+
Header always set X-Frame-Options "SAMEORIGIN"
8+
Header always set Referrer-Policy "strict-origin-when-cross-origin"
9+
Header always set X-XSS-Protection "1; mode=block"
10+
Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
511

612
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
713
# error, crit, alert, emerg.

etc/php.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ zend.enable_gc = On
371371
; threat in any way, but it makes it possible to determine whether you use PHP
372372
; on your server or not.
373373
; http://php.net/expose-php
374-
expose_php = On
374+
expose_php = Off
375375

376376
;;;;;;;;;;;;;;;;;;;
377377
; Resource Limits ;

0 commit comments

Comments
 (0)