Pass the whole origin config to NewOrigin()
Refactor NewOrigin() function