class HttpGateway implements ConfiguresSsrRequests, DisablesSsr, ExcludesSsrPaths, Gateway, HasHealthCheck

Traits

Constants

CONNECTION

The HTTP client connection for SSR requests.

The service provider registers it with the configured timeouts. Its shared transport handler reuses connections to the SSR server across requests.

Methods

bool
inExceptArray(Request $request)

Determine if the request has a URI that should be excluded.

array
getExcludedPaths()

Get the paths excluded from SSR for the current request.

mixed
invokeCallable(callable $value)

Invoke a value whose public contract guarantees it is callable.

mixed
resolveCallable(mixed $value)

Call the given value if callable and inject its dependencies.

bool
useAsCallable(mixed $value)

Determine if the given value is callable, but not a string.

Response|null
dispatch(array $page, Request|null $request = null)

Dispatch the Inertia page to the SSR engine via HTTP.

void
disable(Closure|bool $condition)

Set the condition that determines if SSR should be disabled.

void
except(array|string $paths)

Exclude the given paths from server-side rendering.

void
configureRequestUsing(Closure|null $callback = null)

Configure the HTTP request that is sent to the SSR server.

pendingRequest()

Create the pending HTTP request for the SSR server.

void
handleSsrFailure(array $page, array|null $error)

Handle an SSR rendering failure.

bool
ssrIsEnabled(Request $request)

Determine if the SSR feature is enabled.

bool
isHealthy()

Determine if the SSR server is healthy.

bool
checkHealth()

Determine if the SSR server is healthy, throwing when it cannot be reached.

bool
shutdown()

Shut down the SSR server.

bool
shouldEnsureBundleExists()

Determine if the bundle existence should be ensured.

bool
bundleExists()

Check if an SSR bundle exists.

string
getProductionUrl(string $path = '/')

Get the production SSR server URL.

string|null
getHotUrl(string $path = '/')

Get the Vite hot SSR URL.

bool
isValidSsrResponse(mixed $data)

Determine if the decoded SSR response has the expected shape.

static void
flushState()

Flush all static state.

Details

in ExcludesPaths at line 15
protected bool inExceptArray(Request $request)

Determine if the request has a URI that should be excluded.

Parameters

Request $request

Return Value

bool

at line 154
array getExcludedPaths()

Get the paths excluded from SSR for the current request.

Overrides ExcludesPaths::getExcludedPaths() to read from per-request InertiaState instead of an instance property.

Return Value

array

in ResolvesCallables at line 14
protected mixed invokeCallable(callable $value)

Invoke a value whose public contract guarantees it is callable.

Parameters

callable $value

Return Value

mixed

in ResolvesCallables at line 22
protected mixed resolveCallable(mixed $value)

Call the given value if callable and inject its dependencies.

Parameters

mixed $value

Return Value

mixed

in ResolvesCallables at line 30
protected bool useAsCallable(mixed $value)

Determine if the given value is callable, but not a string.

Parameters

mixed $value

Return Value

bool

at line 56
Response|null dispatch(array $page, Request|null $request = null)

Dispatch the Inertia page to the SSR engine via HTTP.

Parameters

array $page
Request|null $request

Return Value

Response|null

at line 130
void disable(Closure|bool $condition)

Set the condition that determines if SSR should be disabled.

Parameters

Closure|bool $condition

Return Value

void

at line 140
void except(array|string $paths)

Exclude the given paths from server-side rendering.

Parameters

array|string $paths

Return Value

void

at line 162
void configureRequestUsing(Closure|null $callback = null)

Configure the HTTP request that is sent to the SSR server.

Parameters

Closure|null $callback

Return Value

void

at line 170
protected PendingRequest pendingRequest()

Create the pending HTTP request for the SSR server.

Return Value

PendingRequest

at line 190
protected void handleSsrFailure(array $page, array|null $error)

Handle an SSR rendering failure.

Parameters

array $page
array|null $error

Return Value

void

Exceptions

SsrException

at line 223
protected bool ssrIsEnabled(Request $request)

Determine if the SSR feature is enabled.

Parameters

Request $request

Return Value

bool

at line 242
bool isHealthy()

Determine if the SSR server is healthy.

Return Value

bool

at line 256
bool checkHealth()

Determine if the SSR server is healthy, throwing when it cannot be reached.

Return Value

bool

Exceptions

ConnectionException

at line 274
bool shutdown()

Shut down the SSR server.

Return Value

bool

Exceptions

ConnectionException

at line 288
protected bool shouldEnsureBundleExists()

Determine if the bundle existence should be ensured.

Return Value

bool

at line 296
protected bool bundleExists()

Check if an SSR bundle exists.

Return Value

bool

at line 304
string getProductionUrl(string $path = '/')

Get the production SSR server URL.

Parameters

string $path

Return Value

string

at line 315
protected string|null getHotUrl(string $path = '/')

Get the Vite hot SSR URL.

Parameters

string $path

Return Value

string|null

at line 333
protected bool isValidSsrResponse(mixed $data)

Determine if the decoded SSR response has the expected shape.

Parameters

mixed $data

Return Value

bool

at line 372
static void flushState()

Flush all static state.

Return Value

void