opcodesio/log-viewer

LogViewer::auth not working behind proxy

Opened this issue · 3 comments

Not sure why it is the case, but when Laravel runs with Octane as reverse proxy (in production),

\LogViewer::auth(fn () => auth()->check());

does not work and always leads to a 403 error, while

\Gate::define("viewLogViewer", fn () => auth()->check());

works fine.

PHP-FPM did not have this issue. I tested if it is a remote_addr related thing, by mapping it to the real IP instead of the Docker IP (real_ip_header X-Forwarded-For;), but it didn't help.

I faced the same issue, but even with Gate, I am able to access the viewer but not see the list of log files

I faced the same issue, but even with Gate, I am able to access the viewer but not see the list of log files

Here is actually the problem I am describing, it seems to have already been fixed. I will the proposed solution a try
#366

This might be due to configuration of the proxy. You must forward authorisation and host headers, otherwise Laravel might deny the request.

Dump your request headers in any controller, and make sure you still receive the "Authorization" header, as well as the Host is set to the same as your "APP_URL" variable, or at least the host is added to the "LOG_VIEWER_API_STATEFUL_DOMAINS" variable

https://log-viewer.opcodes.io/docs/3.x/configuration/route-and-domain#production-domains