Yes, this "so" is an anaphor and it demands an antecedent. Normally, an antecedent precedes the anaphor -- which is the reason we call it an antecedent. However, there is a case when the so-called antecedent follows the anaphor in sentence structure. Your first example is a good example of that case.
The "so" appears in a subordinate clause. It's antecedent appears in the main clause.
The subordinate nature of "if you so desire" sets up the expectation that a main clause -- a clause that comes before it in importance if not in word order -- will contain the antecedent. In the main clause of your examples, "[to] download the content" is the nature of the desire. That is the antecedent of "so".
We could paraphrase the example by including the antecedent in the subordinate clause and leaving the anaphor in the main clause, if the subordinate clause occurs first in the word order:
If you desire to download the content, you may [do so].
The anaphor must come second. It can be second in word order or second in clause importance, but it must be at least one of those. The anaphor fails if it comes first in both those considerations:
You may [do so] if you desire to download the content.
In this sentence, the "[to] do so" (or even just the bare "may") does not refer to "to download the content". It has to refer to something else, most likely to something from the prior sentence.
Both of your original examples are correct. The first one is correct because the clause containing the anaphor is second in importance, and we know that a more important clause must follow and must contain the antecedent. The second one is correct because the clause containing the anaphor is second in word order, and we know the antecedent of "so" before we reach the anaphor.
The second example is easier to understand and easier to explain, but it is not more correct than the first. Both examples are correct, both examples can be understood, and both examples can be explained.