Forward JSON registration POST bodies through the ladl.link proxy.
Deploy Ladill Link / deploy (push) Successful in 41s

Event signup from ladl.link sends application/json; re-encoding as form
data dropped the payload and caused failed registrations to redirect to
ladl.link/undefined.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-03 14:06:36 +00:00
co-authored by Cursor
parent 317a2f1981
commit 4dedcf84f6
2 changed files with 64 additions and 1 deletions
+16 -1
View File
@@ -74,7 +74,7 @@ class LinkPlatformProxy
->withHeaders($this->forwardHeaders($request));
$pending = match ($method) {
'POST' => $client->asForm()->post($target, $request->post()),
'POST' => $this->forwardPost($client, $request, $target),
'PATCH' => $client->patch($target, $request->all()),
'DELETE' => $client->delete($target),
default => $client->get($target),
@@ -143,12 +143,27 @@ class LinkPlatformProxy
return array_filter([
'Accept' => $request->header('Accept'),
'Accept-Language' => $request->header('Accept-Language'),
'Content-Type' => $request->header('Content-Type'),
'User-Agent' => $request->header('User-Agent'),
'Referer' => $request->header('Referer'),
self::INTERNAL_HEADER => '1',
]);
}
private function forwardPost(\Illuminate\Http\Client\PendingRequest $client, Request $request, string $target): \Illuminate\Http\Client\Response
{
if ($this->requestSendsJson($request)) {
return $client->asJson()->post($target, $request->all());
}
return $client->asForm()->post($target, $request->post());
}
private function requestSendsJson(Request $request): bool
{
return str_contains(strtolower((string) $request->header('Content-Type', '')), 'application/json');
}
/** @param array<string, array<int, string>> $headers */
private function sanitizeHeaders(array $headers): array
{