Gaussian Filter Close to Image Border
Pixels outside the image borders must be extrapolated.
Now, you need to chose the model of your extrapolation.

For instance, if you're working within the Discrete Fourier model a periodic extrapolation is the native choice.
Usually the most "Eye Friendly" solution is replication based on "Nearest Neighbor".  

Your choice is as valid as any choice, you just need to figure which model it satisfies and if that model suits you.

Yet it has 1 noticeable caveat, it makes your kernel Spatially Variant, which means, without a caring treatment it will hurt performance.
The right thing to do is isolate the pixels which should be carefully treated because of the boundary condition and work very efficiently on the rest.

Tim Holy talks about it in the video Image Representation and Analysis (Go to 42:30).