Page MenuHomePhorge

D4564.1775387926.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D4564.1775387926.diff

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
@@ -263,6 +263,16 @@
Route::get('stats/chart/{chart}', [API\V4\Admin\StatsController::class, 'chart']);
}
);
+
+ Route::group(
+ [
+ 'domain' => 'admin.' . \config('app.website_domain'),
+ 'prefix' => 'v4',
+ ],
+ function () {
+ Route::get('whatsmyip', [API\V4\Admin\UsersController::class, 'whatsmyip']);
+ }
+ );
}
if (\config('app.with_reseller')) {

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 5, 11:18 AM (15 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18833286
Default Alt Text
D4564.1775387926.diff (1 KB)

Event Timeline