AlmaLinux Platform Pages/R-proxy for Synology web
ICT-Coaching Reverse Proxy Migration: HTTPS Between AlmaLinux and Synology
Purpose
This document records the investigation and final solution for running the ICT-Coaching WordPress website behind an AlmaLinux Nginx reverse proxy while keeping WordPress hosted on Synology Web Station. The final architecture uses HTTPS between AlmaLinux and Synology to preserve the original HTTPS state.
Initial Problem
The target architecture was:
Internet
|
| HTTPS
v
AlmaLinux Nginx Reverse Proxy
|
| HTTP
v
Synology Web Station
|
v
WordPressThe problem observed was:
- Access through AlmaLinux resulted in a WordPress redirect loop.
- WordPress returned:
HTTP/1.1 301 Moved Permanently
X-Redirect-By: WordPress
Location: https://www.ict-coaching.be/The problem was initially suspected to be caused by the reverse proxy.
Investigation
Synology Direct Tests
The first important discovery was that the problem existed even without AlmaLinux.
Test:
curl -I -H "Host: www.ict-coaching.be" http://127.0.0.1/Result:
HTTP/1.1 301 Moved Permanently
X-Redirect-By: WordPress
Location: https://www.ict-coaching.be/Direct Apache test on internal port 915:
curl -I -H "Host: www.ict-coaching.be" http://127.0.0.1:915/Result:
HTTP/1.1 200 OKThis indicated that the difference was not Apache itself, but the headers provided by the Synology Nginx proxy layer.
Root Cause Identification
The decisive test was reproducing the headers sent by Synology Web Station.
HTTP forwarding:
curl -I \
-H "Host: www.ict-coaching.be" \
-H "X-Forwarded-Proto: http" \
http://127.0.0.1:915/Result:
HTTP/1.1 301 Moved Permanently
X-Redirect-By: WordPress
Location: https://www.ict-coaching.be/HTTPS forwarding:
curl -I \
-H "Host: www.ict-coaching.be" \
-H "X-Forwarded-Proto: https" \
http://127.0.0.1:915/Result:
HTTP/1.1 200 OKExplanation
WordPress uses the HTTPS information supplied by the proxy. When Synology received an HTTP connection:
X-Forwarded-Proto: httpWordPress assumed the request was insecure and redirected to HTTPS. When Synology received HTTPS:
X-Forwarded-Proto: httpsWordPress correctly served the page.
Synology Web Station Configuration Discovery
The generated Web Station configuration contains:
proxy_pass http://127.0.0.1:915;
proxy_set_header X-Forwarded-Proto $scheme;Therefore:
HTTP connection:
$scheme = httpresults in:
X-Forwarded-Proto: httpHTTPS connection:
$scheme = httpsresults in:
X-Forwarded-Proto: httpsSolution Decision
Instead of modifying Synology generated configuration or WordPress configuration, HTTPS was restored between AlmaLinux and Synology. Final architecture:
Internet
|
| HTTPS
v
AlmaLinux Nginx
|
| HTTPS
v
Synology Nginx Web Station
|
| HTTP
v
Apache :915
|
v
WordPressAdvantages:
- No WordPress modification.
- No Synology generated configuration modification.
- Native Synology Web Station behaviour is preserved.
- HTTPS state is maintained through the reverse proxy chain.
Synology Configuration
The ICT-Coaching Web Station portal was restored to:
HTTP : 80
HTTPS : 443The existing certificate was reused. Verification:
curl -k -I -H "Host: www.ict-coaching.be" https://127.0.0.1/Result:
HTTP/2 200AlmaLinux Configuration
The reverse proxy upstream was changed from:
proxy_pass http://192.168.33.212;to:
proxy_pass https://192.168.33.212;
proxy_ssl_verify off;The temporary certificate was kept during testing.
Verification:
curl -k -I \
--resolve www.ict-coaching.be:443:127.0.0.1 \
https://www.ict-coaching.be/Result:
HTTP/2 200Public IP Verification
The new public path was tested:
curl -k -I \
--resolve www.ict-coaching.be:443:178.118.123.34 \
https://www.ict-coaching.be/Result:
HTTP/2 200The complete reverse proxy path was therefore validated.
Certificate Next Step
The temporary AlmaLinux certificate currently used is:
/etc/letsencrypt/live/iis/A dedicated certificate should be created for:
www.ict-coaching.bePreferred organisation:
/etc/letsencrypt/live/syno/After certificate creation, update AlmaLinux Nginx:
ssl_certificate
/etc/letsencrypt/live/syno/fullchain.pem;
ssl_certificate_key
/etc/letsencrypt/live/syno/privkey.pem;Lessons Learned
- A reverse proxy chain must preserve the original HTTPS state.
- WordPress behaviour depends on the HTTPS information received from the proxy.
- Testing the individual proxy layers separately was essential.
- Synology Web Station generated configuration should not be modified manually when native configuration options exist.
- HTTPS between reverse proxies is a clean solution when the backend application requires HTTPS awareness.