Skip to content

backend: cache special login images#1825

Closed
alxndrsn wants to merge 6 commits into
getodk:nextfrom
alxndrsn:hero-image-immutable
Closed

backend: cache special login images#1825
alxndrsn wants to merge 6 commits into
getodk:nextfrom
alxndrsn:hero-image-immutable

Conversation

@alxndrsn
Copy link
Copy Markdown
Contributor

@alxndrsn alxndrsn commented Apr 21, 2026

Set long-lived cache headers for special config blobs shown as images on the login page:

  • hero image
  • logo

Ref #1822

What has been done to verify that this works as intended?

Added tests.

Why is this the best possible solution? Were any other approaches considered?

It's done in conjunction with preventing clients from seeing the S3 URLs for these images (getodk/central-backend#1810).

The long caching header set here means that the ETag/If-Not-Modified header is probably never even revalidated in practice.

An alternative would be to leave odk-central-backend responsible for this caching header.

That would:

✅ keep the nginx config more consistent
✅ would allow for simpler logic around changing header depending if ts is set in the query string
✅ mean this repo does not need to keep track of changes to the config blobs list
❌ would mean re-defining immutable cache headers in the backend repo

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Leverages caching to streamline their authentication experience.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • branched off and targeted the next branch OR only changed documentation/infrastructure (master is stable and used in production)
  • verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced

alxndrsn and others added 3 commits April 21, 2026 12:39
Set long-lived cache headers for special config blobs shown as images on the login page:

* hero image
* logo

Ref getodk#1822
Comment thread test/nginx/src/mocha/nginx.spec.js Outdated
@alxndrsn
Copy link
Copy Markdown
Contributor Author

alxndrsn commented May 1, 2026

@matthew-white on reflection I think odk-central-backend should be responsible for these headers - I'll add to getodk/central-backend#1810.

@matthew-white
Copy link
Copy Markdown
Member

Sounds good, that makes sense. 👍 Would you consider doing it in a follow-up PR after getodk/central-backend#1810 is merged? Since I reviewed that PR already, it feels slightly easier from my perspective for significant additional work to come in a follow-up PR. Though perhaps I'm overestimating how much code will be involved.

@matthew-white
Copy link
Copy Markdown
Member

(Not a strong preference, just wanted to throw out this idea of a follow-up PR.)

@alxndrsn alxndrsn deleted the hero-image-immutable branch May 4, 2026 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants