1

In my web app, I need to detect the source of the forwarded url from the clients, so I can customize the page for different clients. I know this is possible, but cannot find a way. So please help.

Say my (angular) web app is running at mysite.com. While the clients will be using services in mysite.com, they want the address bar to show their own website such as clientxyz.com all the time. This part is easy with DNS forwarding.

The question here is: I (mysite.com) wants to detect the source of the forwarding, so I know the request is from which client, and thus customize the pages/site for them, giving them a false impression everything is their own. This is a legitimate use case.

So how to do this in javascript, or in Angular (typescript)?

Much appreciation!

Martin C
  • 51
  • 6
  • You could always [get the current url](https://stackoverflow.com/questions/1034621/get-the-current-url-with-javascript) – Andria Mar 24 '19 at 03:37
  • Why don't you use a server to find which client requested the app and pre-configure the app setting based on client. – Narendra Singh Rathore Mar 24 '19 at 03:56
  • You want to know which URL forwarded a person to your website?... without any query string implanted on the forwarder's end – Akber Iqbal Mar 24 '19 at 04:00
  • If you're forwarding everything to the same domain, you shouldn't need to care about what domain was forwarded. To the end user, their domain doesn't change, so just grab whatever the current url's domain segment is and use that to configure your app. – Brandon Taylor Mar 24 '19 at 14:22
  • Thanks all! I host my app in AWS S3, the s3 bucket url is,say, http://xxx.mybucket.xxxamazonaws.com.But I don't want to use this externally, I want to use my own domain -- mysite.com. So in mysite.com DNS setting, I forward everything to the AWS s3 url. That part works. Now in the app code, i want to detect the very entry point is mysite.com...the above trick, it actually sees the aws s3 url using window.location.href. My clients may want to keep their own domains, so they will forward to the same AWS S3 url, and I want to know who is who, and tailor the site for them. Hope this clarifies. – Martin C Mar 24 '19 at 15:23

0 Answers0