Synology DSM mobile

1. The problem I’m having:

attempt adding

header_up Accept-Encoding “gzip”

header_up Host 192.168.50.52

compression off

but when access DSM mobile page, still show 404 for this file: /scripts/sencha-touch-2.4.1/touch.js?v=90080

but if accessing this file through NAS direct IP:5001, it works

P.S. Desktop view works fine, just mobile view having this 404 issue

2. Error messages and/or full log output:

PASTE OVER THIS HERE IN THIS CODE BLOCK.
Please ensure it looks nice.

3. Caddy version:

2.11.4

4. How I installed and ran Caddy:

Type here

a. System environment:

Type here

b. Command:

PASTE OVER THIS HERE IN THIS CODE BLOCK.
Please ensure it looks nice.

c. Service/unit/compose file:

PASTE OVER THIS HERE IN THIS CODE BLOCK.
Please ensure it looks nice.

d. My complete Caddy config:

PASTE OVER THIS HERE IN THIS CODE BLOCK.
Please ensure it looks nice.

5. Links to relevant resources:

Type here

After research, trial and error. For anyone doing reverse proxy to Synology DSM.

The mobile version of DSM page have a file /scripts/sencha-touch-2.4.1/touch.js. But this file didn’t exist, it’s actually touch.js.gz on Synology OS. The gzip_static from Synology NGINX doing the decompression before serving. However, when there is reverse proxy in front of Synology, this NGINX function is stripped.

The solution:

Inside reverse_proxy {} block. Add the following to make Synology NGINX think it’s a direct connection:

header_up -Via

Also, for mobile version of DSM, the Caddy forwarded HOST (NAS IP) also not matching ORIGIN (Domain). This will trigger DSM CSRF protection. So you also need to add folllowing inside reverse_proxy {} block to force the HOST to be as ORIGIN:

header_up Host {hostport}