Skip to content

Commit cedf68b

Browse files
committed
add x-forwarded-for header, reduce logs, add request log temporarily
1 parent 64add67 commit cedf68b

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

app/Cloudcli/Common.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static function handleException(\Throwable $e, $message="Unexpected error, pleas
5151
}
5252

5353
static function info(string $message, array $context = []) {
54-
Log::info($message, $context);
54+
//Log::info($message, $context);
5555
}
5656

5757
static function renderServerPath($path, $values) {

app/Cloudcli/ProxyServerHttp.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ static function getHttpClient(Request $request) {
2828
"message" => "Missing env var: CLOUDCLI_API_SERVER"
2929
];
3030
}
31+
\Log::info("Request IP: ". $request->ip());
32+
\Log::info("Request Headers: " . json_encode($request->headers->all()));
3133
return [
3234
"error" => false,
3335
"server" => $server,
@@ -37,6 +39,7 @@ static function getHttpClient(Request $request) {
3739
"headers" => [
3840
"AuthClientId" => $request->header("AuthClientId", env("CLOUDCLI_API_CLIENTID")),
3941
"AuthSecret" => $request->header("AuthSecret", env("CLOUDCLI_API_SECRET")),
42+
"X-Forwarded-For" => $request->ip(),
4043
]
4144
])
4245
];

app/Cloudcli/ProxyServerHttpPostMethods.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static function returnProxyHttpPostJsonResponse(Request $request, $httpMethod, $
3434
} else {
3535
$password = null;
3636
}
37-
\Log::info("${httpMethod} ${res['server']}${serverPath} ".json_encode($postJson));
37+
// \Log::info("${httpMethod} ${res['server']}${serverPath} ".json_encode($postJson));
3838
$clientResponse = $res["client"]->request($httpMethod, $serverPath, [
3939
'json' => $postJson
4040
]);
@@ -43,7 +43,7 @@ static function returnProxyHttpPostJsonResponse(Request $request, $httpMethod, $
4343
"serverPath" => $serverPath,
4444
"postJson" => $postJson
4545
]);
46-
\Log::info($res);
46+
// \Log::info($res);
4747
}
4848
if (Arr::get($res, "error")) {
4949
$messages = [];

app/Cloudcli/ProxyServerPost.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ static function post(Request $request, $command, $httpMethod=null, $handleIntern
320320
}
321321
list($postMultipart, $errors) = self::getPostMultipart($schemaCommand, $fieldValues, $runFields, $flags);
322322
if (count($errors) > 0) {
323-
\Log::info(var_export($errors, true));
323+
// \Log::info(var_export($errors, true));
324324
// TODO: output multiple errors
325325
list($name, $value, $message) = $errors[0];
326326
return self::_getInvalidFlagError($name, $value, $message);

0 commit comments

Comments
 (0)