Comma use before where and in which

Solution 1:

Use a comma before non-restrictive clauses, and don't use a comma before restrictive clauses. See this webpage.

How do you know whether a clause is restrictive or non-restrictive? It's restrictive if the information is essential, and limits the scope of the thing it's modifying. It's non-restrictive if the information is non-essential. For both of your sentences, the clause can be analyzed as either restrictive or non-restrictive, so in cases like this, the comma is optional.