Skip to content

Feature/8994 cache control - #339

Merged
utas-raymondng merged 6 commits into
mainfrom
feature/8994-cache-control
Aug 28, 2026
Merged

Feature/8994 cache control#339
utas-raymondng merged 6 commits into
mainfrom
feature/8994-cache-control

Conversation

@utas-raymondng

@utas-raymondng utas-raymondng commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator
  1. Allow config which api call enable cache on cloudfront, the param need to exact the same
  2. Update the stacmodel version to match the latest
  3. Enable trail elastic search license in docker during testing
  4. If Cache-control already set, we do not override it

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds configurable HTTP Cache-Control headers for an exact-match GET request (path + query params) to support CloudFront caching, updates configuration binding to a new OgcApiProperties record, and adjusts test infrastructure/dependencies (Elasticsearch trial license during tests, stacmodel bump).

Changes:

  • Introduce HttpCacheControlFilter and ogcapi.http-cache configuration mappings to set Cache-Control only for exact request matches.
  • Add OgcApiProperties (ogcapi.*) and switch the admin “explain” toggle to use configuration properties instead of @Value.
  • Enable Elasticsearch trial licensing in Testcontainers-based tests; bump stacmodel to 0.0.66.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
server/src/main/java/au/org/aodn/ogcapi/server/core/http/HttpCacheControlFilter.java New servlet filter that applies Cache-Control for configured exact-match GET requests.
server/src/main/java/au/org/aodn/ogcapi/server/core/configuration/OgcApiProperties.java New @ConfigurationProperties record for ogcapi.debug and ogcapi.http-cache.
server/src/main/resources/application.yaml Adds ogcapi.http-cache configuration mapping for /api/v1/ogc/collections.
server/src/main/java/au/org/aodn/ogcapi/server/core/configuration/Config.java Registers OgcApiProperties in @EnableConfigurationProperties.
server/src/main/java/au/org/aodn/ogcapi/server/common/RestAdminApi.java Uses OgcApiProperties.debug().elasticsearchExplainEnabled() gate for explain endpoints.
server/src/main/java/au/org/aodn/ogcapi/server/common/RestAdminService.java Removes @Value-based explain toggle plumbing.
server/src/test/java/au/org/aodn/ogcapi/server/core/http/HttpCacheControlFilterTest.java New unit tests validating exact-match cache header behavior.
server/src/test/java/au/org/aodn/ogcapi/server/common/RestApiTest.java Adds integration test asserting Cache-Control presence on the configured query.
server/src/test/java/au/org/aodn/ogcapi/server/core/configuration/ElasticSearchTestConfig.java Starts Elasticsearch trial license for tests (needed for licensed semantic features).
server/src/main/java/au/org/aodn/ogcapi/server/core/configuration/CustomWebMvcConfigurer.java Minor formatting-only change.
pom.xml Bumps managed stacmodel version to 0.0.66.
server/pom.xml Removes a duplicated jackson-databind-nullable dependency entry.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +43 to +55
OgcApiProperties.HttpCache httpCache = ogcApiProperties.httpCache();
if (httpCache == null || !httpCache.enabled() || (request != null && !HttpMethod.GET.matches(request.getMethod()))) {
if (filterChain != null) {
filterChain.doFilter(request, response);
}
return;
}

if (filterChain != null) {
CacheControlResponseWrapper wrapped = new CacheControlResponseWrapper(request, response, httpCache);
filterChain.doFilter(request, wrapped);
wrapped.applyIfEligible();
}
Comment on lines +10 to +17
public record OgcApiProperties(
@DefaultValue Debug debug,
@DefaultValue HttpCache httpCache
) {
public record Debug(
@DefaultValue("false") boolean elasticsearchExplainEnabled
) {
}
Comment on lines +808 to +811
/**
* A config set for this particular api call, we need to set the cache control header to signal cloud-front caching
* @throws IOException Not expected
*/
"5c418118-2581-4936-b6fd-d6bedfe74f62.json",
"19da2ce7-138f-4427-89de-a50c724f5f54.json",
"516811d7-cd1e-207a-e0440003ba8c79dd.json",
"35234913-aa3c-48ec-b9a4-77f822f66ef8.json" // This one have cloud optimized index, that is assets.summary value

@weited weited left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@utas-raymondng
utas-raymondng merged commit ce72d6b into main Aug 28, 2026
5 checks passed
@utas-raymondng
utas-raymondng deleted the feature/8994-cache-control branch August 28, 2026 03:46
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.

3 participants