FileRelay
Documentation
Try our Sandbox

connectors/change-detection

Change Detection & Retrieval Modes

When FileRelay acts as your SAP content server, archived documents are served back from a destination. If someone changes a file directly at the destination — in the S3 console, the Azure portal, or a sync tool — FileRelay can detect it, record it, and (depending on mode) refuse to serve the changed copy to SAP.

Retrieval modes

Each content-server destination (S3, R2, MinIO, GCS, Azure Blob or SharePoint with Use this destination for → Content server, see Content Server Bindings) has a Retrieval mode, set right under that choice on the destination form.

Mode Behaviour when the destination copy no longer matches the archived original
Strict (default) The read fails. SAP and the document viewer get an error, never altered bytes. Use for invoices, contracts, and anything legally immutable.
Latest The current destination bytes are served, and the document is marked as modified at destination. Use for working documents that are legitimately edited downstream.

In both modes the change is recorded under Destination Changes in the sidebar, and the document page shows a drift banner.

How changes are detected

Detection does not depend on any single mechanism:

  1. At read time. Every SAP read and document preview hashes the fetched copy against the SHA-256 recorded at archive time. A mismatch — or a missing object — is recorded immediately. No setup required; this works in content-server mode out of the box.
  2. Provider events (push). If you wire your storage events to FileRelay, changes are recorded when they happen, even before anyone reads the document. Setup per provider is below.
  3. On-demand verification. The Verify destination copies button on a document page (or POST /documents/{id}/verify-retrieval in the API) checks that document's copies immediately.

Events alone only prove something changed (an ETag is not a hash), so an event triggers a targeted verification of just that file, which settles the verdict: matched, diverged, deleted, or unknown (not yet verifiable). There is no background sweep of all documents.

FileRelay stamps every delivered object with its SHA-256 as provider metadata (filerelay_sha256), so most verifications compare hashes from a metadata (HEAD) request without downloading the file.

Provider event setup

Enable change notifications on the destination first (FileRelay rejects events for destinations without it), then point your provider at the destination's event endpoint. Replace {destinationId} with the destination's ID (visible on its settings page).

Amazon S3 / R2 / MinIO — POST /api/events/destinations/{destinationId}/s3-events

Accepts S3 Event Notifications and EventBridge events. S3 cannot sign webhooks, so authenticate with the shared token you set under change notifications:

  • Header: X-FileRelay-Event-Token: <your event token>
  • AWS: enable EventBridge on the bucket (or an S3 notification → Lambda/SQS forwarder) and deliver to this endpoint with that header.

Azure Blob — POST /api/events/destinations/{destinationId}/azure-event-grid

Create an Event Grid subscription on the storage account for BlobCreated / BlobDeleted, targeting this endpoint, and set the subscription's aeg-sas-key to the key in your change notifications settings. FileRelay handles the subscription validation handshake automatically.

Google Cloud Storage — POST /api/events/destinations/{destinationId}/gcs-events

Create a bucket notification on a Pub/Sub topic (gcloud storage buckets notifications create gs://BUCKET --topic=TOPIC -f json) and a push subscription pointing at this endpoint. Two auth options:

  • OIDC (recommended): configure the push subscription with an OIDC service account, and set the expected audience under change notifications (gcs_oidc_audience). FileRelay verifies the bearer token with Google.
  • Shared token: send X-FileRelay-Event-Token: <your event token> as a custom push header (simpler for private/on-prem setups).

Any destination — POST /api/events/destinations/{destinationId}/changes

Generic JSON webhook, HMAC-SHA256 signed with your change-notifications signing secret in X-FileRelay-Destination-Signature. Body: {"event_id": "…", "event_type": "updated|created|deleted", "object_id": "<destination object key>", "hash": "<optional sha256>", "etag": "…"}.

SharePoint

No endpoint setup: FileRelay polls the Graph delta feed every five minutes when change notifications are enabled and a drive is configured, and resumes from its saved position after downtime.

Reviewing changes

Destination Changes (sidebar) lists every detected change with its hash verdict. Open a row to compare FileRelay's record (ingest SHA-256, size) against the downstream values side by side, then Acknowledge or Dismiss with an optional note. A copy reported deleted stops being re-checked until its change is acknowledged or dismissed.

Signed download URLs never download the file to mint: they verify via object metadata (hash/ETag) and, in Strict mode, refuse to sign a copy known to have changed. Types that cannot mint URLs (for example SharePoint) return url: null — use the content endpoint instead.