$\def\fp{\mathfrak{p}}\def\fq{\mathfrak{q}}$I'm looking for a reference for the following commutative algebra fact.

Let $A$ be an integrally closed integral domain, with field of fractions $K$. Let $L$ be a finite extension of $K$ and let $B$ be the integral closure of $A$ in $L$. Let $\fp$ be a prime of $A$ and let $\fq_1$, $\fq_2$, ..., $\fq_r$ be the primes of $B$ containing $\fp B$. Let $k = \mathrm{Frac}(A/\fp)$ and $\ell_i = \mathrm{Frac}(B/\fq_i)$.

Then there are positive integers $e_1$, $e_2$, ..., $e_k$ such that, for $\theta \in B$, $$\mathrm{Tr}_{L/K} \theta \equiv \sum e_i \mathrm{Tr}_{\ell_i/k} \theta \bmod \fp.$$

Here we have to be a little careful as $\dim_k \ell_i$ can be infinite, in this case we will take $e_i=0$ so there is no contribution.

I am fairly sure I can prove this. Specifically, the recipe is as follows: If $L/K$ is not separable, take all $e_i=0$. Otherwise, let $M$ be the Galois closure of $L$ over $K$, with Galois group $G$ and let $H$ be the stabilizer of $L$. Let $C$ be the integral closure of $A$ in $M$. Let $I_i \subset G$ be the elements of the Galois group which preserve $\fq_i C$ and act trivially on $\ell_i$ inside $C/\fq_i C$. Then we take $e_i = [I_i:H]$. The proof is just carefully working through the formula $\mathrm{Tr}_{L/K} \theta = \sum_{g \in G/H} g \theta$, and noticing that, whenever something could go wrong because of inseparability, the trace is zero anyway.

But I can only find sources which want to discuss the Dedekind domain case. Any suggestions?

Of course, maybe I am wrong!