Skip to content

Commit 4fb67f8

Browse files
rustyconoverclaude
andcommitted
Add cache-control headers to GET pages and move powered-by to footer
Prevent browser caching on landing and describe HTML pages with Cache-Control: no-cache, no-store, must-revalidate, max-age=0. Move the "Powered by vgi-rpc" info from the page body into the footer. Bump version to 0.1.7. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 02ada1f commit 4fb67f8

4 files changed

Lines changed: 22 additions & 5 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "vgi-rpc"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
description = "Vector Gateway Interface - RPC framework based on Apache Arrow"
55
readme = "README.md"
66
requires-python = ">=3.13"

tests/test_http.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,14 @@ def test_disabled_landing_page(self) -> None:
16601660
assert resp.status_code == 404
16611661
c.close()
16621662

1663+
def test_cache_control_header(self, landing_client: _SyncTestClient) -> None:
1664+
"""Landing page sets Cache-Control to prevent caching."""
1665+
resp = landing_client._client.simulate_get("/vgi")
1666+
cc = resp.headers.get("cache-control", "")
1667+
assert "no-cache" in cc
1668+
assert "no-store" in cc
1669+
assert "max-age=0" in cc
1670+
16631671
def test_post_to_prefix_returns_405(self, landing_client: _SyncTestClient) -> None:
16641672
"""POST /vgi returns 405 Method Not Allowed."""
16651673
resp = landing_client._client.simulate_post("/vgi")
@@ -1734,6 +1742,14 @@ def test_describe_method_hidden(self, describe_client: _SyncTestClient) -> None:
17341742
resp = describe_client._client.simulate_get("/vgi/describe")
17351743
assert "__describe__" not in resp.text
17361744

1745+
def test_cache_control_header(self, describe_client: _SyncTestClient) -> None:
1746+
"""Describe page sets Cache-Control to prevent caching."""
1747+
resp = describe_client._client.simulate_get("/vgi/describe")
1748+
cc = resp.headers.get("cache-control", "")
1749+
assert "no-cache" in cc
1750+
assert "no-store" in cc
1751+
assert "max-age=0" in cc
1752+
17371753
def test_disabled_via_parameter(self) -> None:
17381754
"""When enable_describe_page=False, GET /vgi/describe is not served."""
17391755
server = RpcServer(RpcFixtureService, RpcFixtureServiceImpl(), enable_describe=True)

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vgi_rpc/http/_server.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,6 @@ def _not_found_sink(req: falcon.Request, resp: falcon.Response, **kwargs: Any) -
11621162
a {{ color: #2d5016; text-decoration: none; }}
11631163
a:hover {{ color: #4a7c23; }}
11641164
p {{ line-height: 1.7; color: #6b6b5a; }}
1165-
.meta {{ font-size: 0.9em; color: #6b6b5a; }}
11661165
.links {{ margin-top: 28px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }}
11671166
.links a {{ display: inline-block; padding: 8px 18px; border-radius: 6px;
11681167
border: 1px solid #4a7c23; color: #2d5016; font-weight: 600;
@@ -1181,15 +1180,15 @@ def _not_found_sink(req: falcon.Request, resp: falcon.Response, **kwargs: Any) -
11811180
<img src="https://vgi-rpc-python.query.farm/assets/logo-hero.png" alt="vgi-rpc logo">
11821181
</div>
11831182
<h1>{protocol_name}</h1>
1184-
<p class="meta">Powered by <code>vgi-rpc</code> v{version} &middot; server <code>{server_id}</code></p>
11851183
<p>This is a <code>vgi-rpc</code> service endpoint.</p>
11861184
<div class="links">
11871185
{describe_link}
11881186
{repo_link}
11891187
<a href="https://vgi-rpc.query.farm">Learn more about <code>vgi-rpc</code></a>
11901188
</div>
11911189
<footer>
1192-
&copy; 2026 &#x1F69C; <a href="https://query.farm">Query.Farm LLC</a>
1190+
Powered by <code>vgi-rpc</code> v{version} &middot; server <code>{server_id}</code>
1191+
<br>&copy; 2026 &#x1F69C; <a href="https://query.farm">Query.Farm LLC</a>
11931192
</footer>
11941193
</body>
11951194
</html>"""
@@ -1242,6 +1241,7 @@ def __init__(self, body: bytes) -> None:
12421241
def on_get(self, req: falcon.Request, resp: falcon.Response) -> None:
12431242
"""Return the landing page HTML."""
12441243
resp.content_type = "text/html; charset=utf-8"
1244+
resp.set_header("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0")
12451245
resp.data = self._body
12461246

12471247

@@ -1443,6 +1443,7 @@ def __init__(self, body: bytes) -> None:
14431443
def on_get(self, req: falcon.Request, resp: falcon.Response) -> None:
14441444
"""Return the describe page HTML."""
14451445
resp.content_type = "text/html; charset=utf-8"
1446+
resp.set_header("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0")
14461447
resp.data = self._body
14471448

14481449

0 commit comments

Comments
 (0)