Configuring route & domain
Before you're able to configure this, make sure to first publish the configuration file.
Log Viewer allows you to configure how and where the Log Viewer is accessible from.
Configuring the route
By default, the Log Viewer is accessible via the /log-viewer
route.
This can be configured in the config/log-viewer.php
file:
/* |------------------------------------------------------------------ | Log Viewer Route |------------------------------------------------------------------ | Log Viewer will be available under this URL. | */ 'route_path' => 'log-viewer',
Configuring the domain
If you would like to make the Log Viewer accessible on a certain domain/subdomain only, you can configure that as well:
/* |------------------------------------------------------------------ | Log Viewer Domain |------------------------------------------------------------------ | You may change the domain where Log Viewer should be active. | If the domain is empty, all domains will be valid. | */ 'route_domain' => null,
Production domains
Because Log Viewer is a static frontend that makes API calls, it utilises similar behaviour as Laravel Sanctum for making these API calls "stateful". But to ensure we're not accepting API calls from unknown domains (bad actors), we need to define a list of domains we can expect requests from.
To make sure Log Viewer's requests are correctly authorized, there's a few things you can do.
- If you have just one single domain, make sure that
APP_URL
environment variable matches that domain. If you're accessing Log Viewer via subdomain, make sureAPP_URL
contains that subdomain. - If you have more than one domain and/or subdomain from which you access your application and thus Log Viewer, you can add a comma-separated list of these domains & subdomains to the
LOG_VIEWER_API_STATEFUL_DOMAINS
environment variable, like so:
LOG_VIEWER_API_STATEFUL_DOMAINS=example.com,sub.example.com,otherdomain.com