We consider the solution of the Helmholtz equation −∆u(x)−n(x)2ω2u(x) = f(x), x = (x,y), in a domain Ω which is inﬁnite in x and bounded in y. We assume that f(x) is supported in Ω0 := {x ∈ Ω |a− < x < a+} and that n(x) is x-periodic in Ω\Ω0. We show how to obtain exact boundary conditions on the vertical segments, Γ− := {x ∈ Ω |x = a−} and Γ+ := {x ∈ Ω |x = a+}, that will enable us to ﬁnd the solution on Ω0 ∪Γ+ ∪Γ−. Then the solution can be extended in Ω in a straightforward manner from the values on Γ− and Γ+. The exact boundary conditions as well as the extension operators are computed by solving local problems on a single periodicity cell.