Skip to content

PD-6059: Serve public record page from orcid-web with Last-Modified / If-Modified-Since (304) - #7648

Open
cryptalith wants to merge 1 commit into
mainfrom
lmendoa/PD-6059-if-modified-since
Open

PD-6059: Serve public record page from orcid-web with Last-Modified / If-Modified-Since (304)#7648
cryptalith wants to merge 1 commit into
mainfrom
lmendoa/PD-6059-if-modified-since

Conversation

@cryptalith

Copy link
Copy Markdown
Member

Summary

Implements PD-6059: the public record page (orcid.org/{orcid-id}) now sends a Last-Modified header equal to the record's last_modified and answers If-Modified-Since with 304 Not Modified, so search crawlers can revalidate cheaply (SEO).

Why this shape

In production the record-page HTML is served statically from the orcid-web-frontend war (Tomcat DefaultServlet), so no per-record Last-Modified was possible there. This PR makes PublicProfileController.publicPreview serve the Angular shell itself:

  • New StaticShellService fetches index.html from the co-deployed orcid-web-frontend war (per-locale, TTL cache, serves stale on fetch failure). Locale comes from the locale_v3 cookie via LocaleManager, mirroring the nginx langCode map.
  • publicPreview non-print branch: Cache-Control: no-cache, then Spring ServletWebRequest.checkNotModified(lastModified) (handles IMS parsing, second truncation, HEAD, 304), else writes the shell.
  • No ETag is emitted — Cloudflare has been observed stripping it (that was the reason for the old no-store).
  • /print path unchanged. 404/lowercase-x redirects unchanged.
  • orcid-web-proxy nginx: record-page location routes to /orcid-web and stops forcing no-store.

New properties (defaults suit local dev): org.orcid.frontend.web.frontendShellBaseUri, org.orcid.frontend.web.frontendShellCacheTtlMinutes.

Testing

  • PublicProfileControllerTest (12 tests, all passing): 200 with RFC-1123 Last-Modified/no-cache/no ETag, 304 on equal/future IMS (incl. ms-truncation), 200 on stale/malformed IMS, HEAD handling, locked/deprecated records, 404 redirect, /print unchanged.
  • New StaticShellServiceTest (5 tests): locale mapping, TTL cache, stale-on-error, failure without cache.

Rollout

Deploy this first — it is inert until nginx routes record-page HTML to orcid-web. The per-env nginx/property changes go out as separate orcid-ansible_inventory-private PRs (QA → SBOX → PROD). Rollback is a one-line nginx revert.

Follow-ups: same treatment for /{orcid}/summary and /{orcid}/print, Cypress e2e spec.

…-Modified-Since (304)

The public record page HTML was served statically from the orcid-web-frontend
war, so no per-record Last-Modified was possible. publicPreview now serves the
Angular shell itself: it sends Last-Modified from the record last_modified,
answers fresh If-Modified-Since with 304 (Spring checkNotModified), and sets
Cache-Control: no-cache. The shell is fetched from the co-deployed frontend
war by the new StaticShellService (per-locale TTL cache, stale-on-error). No
ETag is emitted since Cloudflare has been observed stripping it. The /print
path is unchanged. orcid-web-proxy nginx now routes record pages to orcid-web
and stops forcing no-store.
@amontenegro

Copy link
Copy Markdown
Member

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