Thanks guys.
I've looked into ProcessPageEditLink before as well but as Robin S says I think it's absolute to the root, not including domain URL.
I also agree that generally it's better practice to keep it this way but in my specific case my the backend, which is setup as an API, is on a different URL than the front end.
Have not tested it yet, but for anyone else looking into this issue, there's another thread covering it with possible solution: