Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle CQL2 Item Filters for APIs that don't implement Features Filter conformance class #37

Open
alukach opened this issue Mar 19, 2025 · 0 comments
Labels
question Further information is requested

Comments

@alukach
Copy link
Member

alukach commented Mar 19, 2025

Context

#17 added functionality that applied a CQL2 filter to any requests made to /collections/{collection_id}/items. However, reviewing the Conformance Classes section of the Filter Extension1, we see:

The implementation may support the OAFeat Part 3 Features Filter conformance classes:

  • Features Filter (http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/features-filter) binds the Filter and CQL2 conformance classes to the Features resource (/collections/{cid}/items).

While the Filter extension is a hard requirement of the Item Filtering functionality of STAC Auth Proxy, we should support upstream APIs that don't implement Features Filter.

Ideas

A configuration variable could dictate whether to pass through requests to upstream APIs that support the Features Filter. However, the proxy's behavior when the Features Filter is not supported is yet to be determined.

Transparently serve /search content

The proxy could proxy content from the Item search endpoint.

Example:

  • incoming request:
  • generated CQL2: "naip:year"='2022'
  • request sent to upstream STAC API: /search?filter="naip:year"='2022'

This works as the response bodies are almost identical, except for the links attribute:

▶ curl -s "http://localhost:8001/search?filter=collection='naip'" | jq .links            
[
  {
    "rel": "root",
    "type": "application/json",
    "href": "http://localhost:8001/"
  },
  {
    "rel": "self",
    "type": "application/json",
    "href": "http://localhost:8001/search?filter=collection='naip'"
  }
]
▶ curl -s "http://localhost:8001/collections/naip/items" | jq .links           
[
  {
    "rel": "collection",
    "type": "application/json",
    "href": "http://localhost:8001/collections/naip"
  },
  {
    "rel": "parent",
    "type": "application/json",
    "href": "http://localhost:8001/collections/naip"
  },
  {
    "rel": "root",
    "type": "application/json",
    "href": "http://localhost:8001/"
  },
  {
    "rel": "self",
    "type": "application/geo+json",
    "href": "http://localhost:8001/collections/naip/items"
  }
]

The proxy could attempt to rewrite these on the outgoing response (the rel property would make it simple to assess what needs to be swapped) but this could get sticky (e.g. consider pagination).

Explicitely redirect to /search

Perhaps it would be better to return a simple redirect to the client, informing them that the content is available via the Item Search endpoint.

A purist could say this would knock the API out of compliance with the STAC specification. However, the effective behavior would be roughly the same.

Footnotes

  1. https://github.com/stac-api-extensions/filter?tab=readme-ov-file#conformance-classes

@alukach alukach added the question Further information is requested label Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant