简体   繁体   中英

Identify the referrer domain in rails

I have a web site which has 2 domains

ex : www.site1.com www.site2.com (which will forward to www.site1.com with domain masking)

www.site1.com is where the actual web server rungs

www.site2.com is just a domain name forwarder and I use mask to make the user feel he/she is in www.site2.com even though he/she is in www.site1.com

But in underlying code I want to distinguish both the request (who came from www.site1.com and who came from www.site2.com) so that I can load their UI accrodingly

I tried request.host as well as request.referrer which always gives www.site1.com

and when I get the source code of the www.site2.com (which redirects to site1) it has this,

sameera gayan

So what is the best option for getting the 2 different site URL's ,

thanks in advance

cheers, Sameera

If you have a static IP, you could set up www.site2.com to point to the IP address, instead of the other domain name.

Another option is to create a third name as a subdomain of site1.com, such as site2.site1.com that points to the same place as www.site1.com. Then forward www.site2.com to site2.site1.com. You would then be able to pick up that alias.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM