a Basic version can be found over here:
https://answers.unrealengine.com/questions/4763/how-to-constrain-cameracontroller-rotation.html
it was answered by ue4-archive
this shows how to take the input from a character controller and restrain it to +/-100 degrees horizontally and +/- 20 degrees vertically, so, change those values as you see fit.
p.s. Don’t forget to mark questions answered.