diff options
| author | 2026-01-03 17:48:33 +0100 | |
|---|---|---|
| committer | 2026-01-03 17:48:33 +0100 | |
| commit | 15814cfd35b8ac704a761530e14bd9efe6500ddc (patch) | |
| tree | 8484110f75cf1de09f285bffb9305cd1aa32d71d /p/.htaccess | |
| parent | 252703305758e2ed0e6257ae94fdb3b4b90f7184 (diff) | |
Add remote user in Apache logs, also for API (#8392)
* API: add remote user in Apache logs
fix https://github.com/FreshRSS/FreshRSS/discussions/8385
Example:
```
2026-01-01T18:38:28.645486326Z 0.0.0.0 - alex [01/Jan/2026:19:38:28 +0100] "GET /api/greader.php/reader/api/0/subscription/list?output=json HTTP/1.1" 200 9798 "-" "curl/8.14.1"
```
* Fallback mod_rewrite
* Log remote user with same priority as FreshRSS_http_Util::httpAuthUser()
Diffstat (limited to 'p/.htaccess')
| -rw-r--r-- | p/.htaccess | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/p/.htaccess b/p/.htaccess index 4d2c6e52b..06790616b 100644 --- a/p/.htaccess +++ b/p/.htaccess @@ -57,3 +57,12 @@ AddDefaultCharset UTF-8 SetEnvIfExpr "%{CONN_REMOTE_ADDR} =~ /(.*)/" CONN_REMOTE_ADDR=$1 </IfModule> </IfModule> + +# Log remote user with same priority as FreshRSS_http_Util::httpAuthUser(). See also api/.htaccess +<IfModule mod_setenvif.c> + SetEnvIfExpr "reqenv('LOG_REMOTE_USER') == ''" LOG_REMOTE_USER=- + SetEnvIfExpr "reqenv('LOG_REMOTE_USER') == '-' && reqenv('REMOTE_USER') =~ /(.+)/" LOG_REMOTE_USER=$1 + SetEnvIfExpr "reqenv('LOG_REMOTE_USER') == '-' && reqenv('REDIRECT_REMOTE_USER') =~ /(.+)/" LOG_REMOTE_USER=$1 + SetEnvIfExpr "reqenv('LOG_REMOTE_USER') == '-' && req('Remote-User') =~ /(.+)/" LOG_REMOTE_USER=$1 + SetEnvIfExpr "reqenv('LOG_REMOTE_USER') == '-' && req('X-WebAuth-User') =~ /(.+)/" LOG_REMOTE_USER=$1 +</IfModule> |
