For principal $G$-bundles with $G$ a Lie group there exists a principal $G$-bundle $EG \to BG$ such that we have a bijection [X,BG] \leftrightarrow \text{(principal $G$-bundles over X)}
$ f \mapsto f^* EG $ where $[X,BG]$ is the set of homotopy classes of maps from $X$ to $BG$. As a result of this, homotopic maps induce the same pullback maps of bundles.
My question is the following: for what class of spaces $F$ does there exist $F \to EF \to BF$ that gives a correspondence as above. I am also interested in knowing for what type of $F$ homotopic maps induce the same pullback.
Let's also assume all spaces are (countable) CW complexes.