async fn redirect_to_storage_service(
    tail: Path<String>,
    file_store: Data<dyn FileStore>
) -> HttpResponse
Expand description

GET /api/v0/files/\* Redirects the request to a file storage service.

This is meant for redirecting requests to appropriate storage services. This approach decouples the storage mechanism from the urls. Redirection is done with HTTP status 302 Found and it has a max age of 5 minutes.

Redirects to local file handler in development and to a service in production.

Example

GET /api/v0/files/organizations/1b89e57e-8b57-42f2-9fed-c7a6736e3eec/courses/d86cf910-4d26-40e9-8c9c-1cc35294fdbb/images/nNQbVax81fH4SLCXuQ9NrOWtqfHT6x.jpg

Response headers:

< HTTP/1.1 302 Found
< Date: Mon, 26 Apr 2021 10:38:09 GMT
< Content-Length: 0
< Connection: keep-alive
< cache-control: max-age=300, private
< location: /api/v0/files/uploads/organizations/1b89e57e-8b57-42f2-9fed-c7a6736e3eec/courses/d86cf910-4d26-40e9-8c9c-1cc35294fdbb/images/nNQbVax81fH4SLCXuQ9NrOWtqfHT6x.jpg