4. Given the three sides of $\triangle A B C$ are $a, b, c$, and
$$
\frac{a}{b}+\frac{a}{c}=\frac{b+c}{b+c-a} \text {. }
$$

Then the triangle that satisfies this condition is ( )
(A) equilateral triangle
(B) isosceles triangle with $a$ as the leg
(C) isosceles triangle with $a$ as the base
(D) isosceles right triangle
4. B.

Given $\frac{a(b+c)}{b}=\frac{b+c}{b+c-a}$, eliminating the denominators and factoring yields $(b+c)(b-a)(c-a)=0$. Since $a$, $b$, and $c$ are the lengths of the sides of a triangle, $b+c>0$. Therefore, $b-a=0$ or $c-a=0$, i.e., $b=a$ or $c=a$. Thus, the triangle that satisfies this condition is an isosceles triangle with $a$ as the base.