Route block for outsider

I want to create a route which shoul allow to call only from the site itself and not from any other place

$app->post('/getPlans', function ($request, $response, $args) {
		return $response->write("Access by the same site only");
	});

You may try to use CSRF Protection.