Skip to content

Use HTTP server as web proxy with cache #392

@synopse

Description

@synopse

A caching logic, similar to the PeerCache local temporary cache, is to be used.

For a given URI, e.g. https://mormotcache.ad.company.com/*, we redirect to another server
So that e.g.
https://mormotcache.ad.company.com/https/srvorigin.ad.company.com/application/file
will trigger the following process:

  1. make a HEAD https://srvorigin.ad.company.com/application/file
  2. compute a hash of its URI + last-modify = HASH (not content-length because it may not be available)
  3. check for a local file name from this HASH
    4a) if the file exists, change its timestamp to the current time, and serve it to the client
    4b) if the file does not exist, start downloading from GET https://srvorigin.ad.company.com, serve it in "progressive" mode (like PeerCache) to the client, then eventually copy the file to the local temporary folder
  4. once in a while, check for deprecated files in the local temporary folder

OnRemoteUri event callback could check for the remote URI validity, with any additional information (e.g. TLS client certificate) for both HEAD and GET.

We can't directly reuse the PeerCache logic for this process, because there is no content hashing, and the actual usecase is not the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions