Skip to content
Massimo Melina edited this page May 15, 2024 · 5 revisions

HFS can work behind a reverse proxy. Configuration depends on what software you use, but this is an example using nginx exposing HFS under the path /files/ instead of just /. Adjust it to suit your needs.

location /files/ {
  proxy_http_version 1.1;
  keepalive_timeout 30;
  proxy_buffering off;
  proxy_redirect off;
  proxy_max_temp_file_size 0;
  proxy_set_header        X-forwarded-for $proxy_add_x_forwarded_for;  # forward IP address
  proxy_set_header        X-forwarded-host "example.com"; # this is not always necessary, but host is used by some features like "roots"
  proxy_set_header        X-Forwarded-Proto $scheme; 
  proxy_set_header        X-forwarded-prefix "/files"; # the location without final slash
  client_max_body_size    0;  # disable max size for uploads
  proxy_pass      http://127.0.0.1:80/;
}

This is enough, but you may want to configure generated links accordingly:

  • go to Admin-panel > Internet > Address
  • click the Change button
  • enter the final URL of your proxy including the location

Force HTTPS

If you want to have http-to-https redirection with a reverse-proxy, you cannot use the "Force HTTPS" feature of HFS, as this would redirect to the internal HTTPS port. You should configure your proxy to do the job, instead. Try googling.