Skip to content

Commit

Permalink
fix for ARI trying to replace certs that have already been replaced (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbolger committed Aug 18, 2024
1 parent 2eb08fd commit c0aef03
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Posh-ACME/Public/New-PAOrder.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,22 @@ function New-PAOrder {
# send the request
try {
$response = Invoke-ACME $header $payloadJson $acct -EA Stop
} catch { throw }
} catch {
# ACME server should send HTTP 409 Conflict status if we tried to specify
# a 'replaces' value that has already been replaced. So if we get that,
# retry the request without that field included.
if (409 -eq $_.Exception.Data.status) {
Write-Warning $_.Exception.Data.detail
Write-Verbose "Resubmitting new order without 'replaces' field."
$payload.Remove('replaces')
$payloadJson = $payload | ConvertTo-Json -Depth 5 -Compress
try {
$response = Invoke-ACME $header $payloadJson $acct -EA Stop
} catch { throw }
} else {
throw
}
}

# process the response
$order = $response.Content | ConvertFrom-Json
Expand Down

0 comments on commit c0aef03

Please sign in to comment.