The focus of this paper is on Ahlfors Q-regular compact sets E ⊂ R n such that, for each Q − 2 < α ≤ 0, the weighted measure µα given by integrating the density ω(x) = dist(x, E) α yields a Muckenhoupt Ap-weight in a ball B containing E. For such sets E we show the existence of a bounded linear trace operator acting from W 1,p (B, µα), and the existence of a bounded linear extension operator from B θ p,p (E,We illustrate these results with E as the Sierpiński carpet, the Sierpiński gasket, and the von Koch snowflake.