X-Accel (also known as X-Sendfile or X-Accel-Redirect) is a nice feature that allows a backend app to provide a private URL to the loadbalancer so the backend is free from large-file processing. The loadbalancer is then responsible for serving the contents of the file to the end-user. While a HTTP 301/302 redirect can work in many cases, there are times when the app developer may want to keep the final location secret (e.g., AWS S3 bucket name and path).
Is this X-Accel scenario possible using HAProxy? Can HAProxy fetch a file based on an HTTP header from the backend and then serve it to the end user without revealing the true path of the file?
I knew about the lack of file IO in HAProxy. But isn’t X-Accel just a complicated proxy request? The backend app tells the loadbalancer via an HTTP header to fetch this URL instead?