In the class of polynomial regression models up to degree $n$ we determine the design on $\lbrack -1, 1\rbrack$ that maximizes a product of $n + 1$ determinants of information matrices weighted with a prior $\beta$, where the $l$-th information matrix corresponds to a polynomial regression model of degree $l$, for $l = 0, 1, \cdots, n$. The designs are calculated using canonical moments. We identify a special class of priors $\beta(z)$ depending on one real parameter $z$ so that analogous results are obtained as in the classical $D$- and $D_1$-optimal design problems. The interior support of the optimal design with respect to the prior $\beta(z)$ is given by the zeros of a Jacobi polynomial and all the interior support points have the same masses. The masses at the boundary points $-1$ and $1$ are $(z + 1)/2$ times bigger than the masses of the interior points. The results found in one dimension are generalized to the problem of determining optimal product designs in the case of multivariate polynomial regression on the $q$-cube $\lbrack -1,1\rbrack^q$. Explicit solutions are obtained for the $D$- and $D_1$-optimal product designs in the polynomial model of degree $n$ for all $n \in \mathbb{N}$ and $q \in \mathbb{N}$.