Is it possible to restrict an angular route by ip address or domain?
I am currently using angular 4 with asp.net web api 2. I have an admin route, but I only want the admin route to be accessed by particular ips or a domain.
It is not possible to access IP address of a client only with JS. See this question's answer: How to get client's IP address using javascript only?
There are simple solutions in a form of API that will return you your public ip.
As for domain name you can use window
object from JS to see what domain name is present:
`window.location.host' will return you domain name.
As for forbidding access to some routes you can use Angular guarding concept for that purpose:
https://angular.io/docs/ts/latest/guide/router.html#!#can-activate-guard