Poincaré inequality is stated as follows:

Let $ \Omega $ be bounded, connected, open subset pf $ \mathbb{R}^n $, with a $ C^1 $ boundary $ \partial \Omega $. Assume that $ 1\leq p<\infty $ and $ u\in W^{1,p}(\Omega) $. Then there exists a constant $ C $, depending only on $ n, p $ and $ \Omega $, such that $$ \left\|u-\frac{1}{|\Omega|}\int_{\Omega}u\right\|_{L^p(\Omega)}\leq C\left\|Du\right\|_{L^p(\Omega)} $$ for each function $ u\in W^{1,p}(\Omega) $.

I have already know the proof from compactness argument. Now I want to prove this inequality by direct computation. First, I consider the condition that $ \Omega $ is convex and prove the inequality. Now I want to deal with the general case by using the extension theorem of Sobolev space. However, I can not deal with the error terms when using the theorem. Can you give me some hints or references?