For a function to be convex it should have a convex domain besides the first-order, second-order conditions. Why do we need that the domain of the function should also be convex?
Edit:
What I am trying to say is that its possible for a function to be convex on a non-convex domain. Here is a link: link
Then why add the convexity condition specifically???
You need the condition on the domain, because the definition of the convex function implies calculating $f(\lambda x+(1-\lambda)y)$ for every $\lambda \in (0,1)$ and for every $x,y \in D$.
For the function to be well defined you need that $$ x,y \in D,\lambda \in (0,1) \Rightarrow \lambda x+(1-\lambda)y \in D$$ and that is exactly the property which characterizes convex domains.