Refactor certificate operations to use relative URL paths - #1231
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the HTTP 202 Accepted responses for certificate issuance/renewal and operation-status polling so the Location header is generated via a route URL (intended to avoid leaking an internal host when behind a reverse proxy), and updates the API reference to clarify how clients should interpret the Location header.
Changes:
- Updated
AddCertificate,RenewCertificate, andGetOperationto returnAccepted(Url.RouteUrl(...))instead ofAcceptedAtFunction(...)soLocationcan be a host-less URL. - Updated API documentation to clarify that the
Locationheader should be treated as a relative path to be resolved by the caller.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Acmebot.App/Functions/Http/AddCertificate.cs | Generates the operation polling Location via Url.RouteUrl for issuance requests. |
| src/Acmebot.App/Functions/Http/RenewCertificate.cs | Generates the operation polling Location via Url.RouteUrl for renewal requests. |
| src/Acmebot.App/Functions/Http/GetOperation.cs | Returns 202 with Location pointing to the operation polling route while pending/running. |
| docs/reference/api.md | Documents that the Location header is a relative path that should be resolved by clients. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates how HTTP 202 Accepted responses are handled for certificate issuance and renewal operations. The main change is switching from using
AcceptedAtFunctiontoAcceptedwith a route URL, and clarifying the documentation about theLocationheader. This ensures that clients receive a fully resolved URL for polling operation status, improving API usability and consistency.API Response Handling:
AddCertificate.cs,RenewCertificate.cs, andGetOperation.csto useAccepted(Url.RouteUrl(...))instead ofAcceptedAtFunction(...), ensuring theLocationheader contains a properly resolved route URL for operation polling. [1] [2] [3]Documentation:
docs/reference/api.mdthat theLocationheader returned from certificate operations is a relative path and should be resolved against the endpoint called.Fixes #1227