Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117905024
D4564.1775387926.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D4564.1775387926.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D4564: A way to check the request ip
Attached
Detach File
Event Timeline