Update pin domain logic to adapt for private custom domain

Update pin domain logic to adapt for private custom domain pin protected private sites as well as old private files by pin
#4238