diff --git a/src/app/Http/Controllers/API/V4/Admin/UsersController.php b/src/app/Http/Controllers/API/V4/Admin/UsersController.php --- a/src/app/Http/Controllers/API/V4/Admin/UsersController.php +++ b/src/app/Http/Controllers/API/V4/Admin/UsersController.php @@ -421,4 +421,18 @@ 'message' => self::trans('app.user-update-success'), ]); } + + /** + * Get the ip that kolab4 sees from the request. + * + * Useful for testing proxy settings and making sure the X-Forwarded-For Header is picked up. + * + * @return \Illuminate\Http\JsonResponse The response + */ + public function whatsmyip(Request $request) + { + return response()->json([ + 'ip' => $request->ip() + ]); + } } diff --git a/src/routes/api.php b/src/routes/api.php --- a/src/routes/api.php +++ b/src/routes/api.php @@ -261,6 +261,7 @@ Route::get('wallets/{id}/transactions', [API\V4\Admin\WalletsController::class, 'transactions']); Route::get('stats/chart/{chart}', [API\V4\Admin\StatsController::class, 'chart']); + Route::get('whatsmyip', [API\V4\Admin\UsersController::class, 'whatsmyip']); } ); }