Skip to content

server: Drop HTML index page#8478

Open
johanfylling wants to merge 4 commits intoopen-policy-agent:mainfrom
johanfylling:drop_index_page
Open

server: Drop HTML index page#8478
johanfylling wants to merge 4 commits intoopen-policy-agent:mainfrom
johanfylling:drop_index_page

Conversation

@johanfylling
Copy link
Copy Markdown
Contributor

Fixes: #8477

Fixes: open-policy-agent#8477
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
mainRouter.Handle("GET /v1/compile/{path...}", s.instrumentHandler(s.v1CompileFilters, PromHandlerV1Compile))
mainRouter.Handle("GET /v1/config", s.instrumentHandler(s.v1ConfigGet, PromHandlerV1Config))
mainRouter.Handle("GET /v1/status", s.instrumentHandler(s.v1StatusGet, PromHandlerV1Status))
mainRouter.Handle("POST /{$}", s.instrumentHandler(s.unversionedPost, PromHandlerIndex))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should we drop the unversioned query endpoint too?
This one might actually be used.

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.

Yeah "webhook" usage, potentially.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 2, 2026

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit a14f3df
🔍 Latest deploy log https://app.netlify.com/projects/openpolicyagent/deploys/69d7641602e6fd00085198be
😎 Deploy Preview https://deploy-preview-8478--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

\ \_______\ \ \__\ \ \__\ \__\
\|_______| \|__| \|__|\|__|
</pre>
Open Policy Agent - An open source project to policy-enable your service.<br>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I suppose we could also keep this, and just drop the query form (and maybe the info fields) below ..

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.

What do we gain? We're only telling the world what this server is. I don't think there's any benefit here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

True. Looks like we have some failing tests because of dropping the endpoint, so maybe someone else is using it for health/liveliness checks despite there being dedicated endpoints for that 🤷.

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.

The health endpoint isn't exactly new, so I think the empty-body 200 is a good compromise.

Copy link
Copy Markdown
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

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

LGTM. Do you think we should solicit some more opinions?

@johanfylling
Copy link
Copy Markdown
Contributor Author

Yea, let's let this one bake for a bit 👍. I just wanted to get a PR up so it doesn't fall to the wayside. We have a month until the next release 🙂.

@anderseknert
Copy link
Copy Markdown
Member

For better or worse, I have seen many use this as a "is OPA up?" endpoint. I'd suggest that if we do remove the HTML form page (and I'll be pouring one out for you, old friend) we keep the endpoint just serving a static 200 OK or so, at least until the next major version bump.

@johanfylling
Copy link
Copy Markdown
Contributor Author

@anderseknert , yeah, let's do that 👍. We even have some tests using this for status checks ourselves, it would seem 😄.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
}

func (*Server) indexGet(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
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.

[nit] I think that's what stdlib will do if we just do nothing here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Then we get a 405 Method Not Allowed. So if that's the default behavior we're doing something to disable it.

Copy link
Copy Markdown
Contributor

@srenatus srenatus Apr 2, 2026

Choose a reason for hiding this comment

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

❗ OK TIL. 🤔

return
}

w.WriteHeader(http.StatusNoContent)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
Build Commit: {{ .BuildCommit }}<br>
Build Timestamp: {{ .BuildTimestamp }}<br>
Build Hostname: {{ .BuildHostname }}<br>
<br>
Copy link
Copy Markdown
Contributor

@charlieegan3 charlieegan3 Apr 7, 2026

Choose a reason for hiding this comment

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

I agree that removing the form makes sense, but I might vote to keep the Commit and Version as I am unsure how you might do this without running rego otherwise and people might depend on that if not the form?

Release #1, #2, ..#n

  1. We can remove the form. Add deprecation text to page.
  2. Still 200, but remove the version etc.
  3. Remove the page. but still show a 200OK and {"status": "OK"}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm ok with only dropping the form 👍.
Looks like maybe only the version is part of the /status endpoint's returned labels; maybe we should add these other fields too(?).

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.

Yeah I think that makes sense as a continuity gesture at least. It doesn't look like it's possible to change the version label or the id one either, would these become the same? it might be that someone is using hostname in their own labels.

but no query form.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
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.

remove html index page

4 participants