Fall back to Events when platform QR proxy returns 404.
Deploy Ladill Link / deploy (push) Successful in 48s
Deploy Ladill Link / deploy (push) Successful in 48s
Event pages like sales-webinar live on events.ladill.com, but ladl.link only proxied to ladill.com/q/* — fix by retrying events.ladill.com when the platform hub has no matching code. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -27,8 +27,17 @@ class LinkPlatformProxy
|
||||
);
|
||||
}
|
||||
|
||||
$platform = rtrim((string) config('app.platform_url', 'https://ladill.com'), '/');
|
||||
$target = $platform.'/q/'.$slug;
|
||||
$platformResponse = $this->forwardToQrHub($request, $slug, $normalizedPath, $this->platformBaseUrl());
|
||||
if ($platformResponse->getStatusCode() !== 404) {
|
||||
return $platformResponse;
|
||||
}
|
||||
|
||||
return $this->forwardToQrHub($request, $slug, $normalizedPath, $this->eventsBaseUrl());
|
||||
}
|
||||
|
||||
private function forwardToQrHub(Request $request, string $slug, string $normalizedPath, string $hubBase): Response
|
||||
{
|
||||
$target = rtrim($hubBase, '/').'/q/'.$slug;
|
||||
if ($normalizedPath !== '') {
|
||||
$target .= '/'.$normalizedPath;
|
||||
}
|
||||
@@ -98,6 +107,18 @@ class LinkPlatformProxy
|
||||
return $this->forward($request, $slug, substr($path, strlen($slugPrefix)));
|
||||
}
|
||||
|
||||
private function platformBaseUrl(): string
|
||||
{
|
||||
return rtrim((string) config('app.platform_url', 'https://ladill.com'), '/');
|
||||
}
|
||||
|
||||
private function eventsBaseUrl(): string
|
||||
{
|
||||
$domain = (string) config('app.events_domain', 'events.ladill.com');
|
||||
|
||||
return 'https://'.$domain;
|
||||
}
|
||||
|
||||
private function transferBaseUrl(): string
|
||||
{
|
||||
$domain = (string) config('app.transfer_domain', 'transfer.ladill.com');
|
||||
@@ -133,13 +154,13 @@ class LinkPlatformProxy
|
||||
|
||||
private function rewriteLocation(string $location, string $slug): string
|
||||
{
|
||||
$platform = rtrim((string) config('app.platform_url', 'https://ladill.com'), '/');
|
||||
$prefix = $platform.'/q/'.$slug;
|
||||
foreach ([$this->platformBaseUrl(), $this->eventsBaseUrl()] as $base) {
|
||||
$prefix = $base.'/q/'.$slug;
|
||||
if (str_starts_with($location, $prefix)) {
|
||||
$suffix = substr($location, strlen($prefix));
|
||||
|
||||
if (str_starts_with($location, $prefix)) {
|
||||
$suffix = substr($location, strlen($prefix));
|
||||
|
||||
return LadillLink::url($slug).$suffix;
|
||||
return LadillLink::url($slug).$suffix;
|
||||
}
|
||||
}
|
||||
|
||||
$transfer = rtrim($this->transferBaseUrl(), '/').'/q/'.$slug;
|
||||
|
||||
Reference in New Issue
Block a user