top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Rails: How can I obtain the name of the domain that the user entered to access my site?

0 votes
436 views

I am proposing to have multiple domain name pointing towards a single site. On the site I would like to display the domains name that was used. How can I obtain the name of the domain that the user entered to access my site?

posted Aug 20, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

One could forge a request with Host header set to 'example.com' and connect to localhost, thus the question.

If the header value is the thing you're looking for: it is contained in request.host.

answer Aug 21, 2014 by Sanketi Garg
Similar Questions
0 votes

I have a home server set up with a couple of things going on. Here is the weird thing that I can't figure out. I can access everything just fine from an INTERNET connection external to my LAN using my domain name, let's say "domain.com". So, if I type into my browser on my LAN "www.domain.com", it searches without actually finding it's destination giving up after a period of time saying the server cannot be found (usually an error 408).
But, if I type www.domain.com on my mobile phone browser using my data connection (not on the LAN), it connects without a hitch and everything functions fine. I have done this set up before at a different home, but since I moved, I have come across this problem and either don't remember having this happen before or don't remember what I did to resolve it. Also, I changed ISP and that seemed to be the beginning of the problem. I set up my port forwards and checked my firewalls on the router. I looked on google and couldn't find anything specific to my problem. Everything I have read in the user documentation for apache seems to be set up correctly. I guess my question is what do I not know that I should know to be looking for. :-/
Could some one direct me as to what I should look for?

+2 votes

I have purchased a domain xyz.com but no hosting. Can I forward a subdomain say photo.xyz.com to my flickr account having URL like flickr.com/photos/abcadjsakjda.

0 votes

I have deployed a ruby on rails app on two instances of production server, now there are two separate log file are being created for different instances. My question is how I can make a single log file for both the instances?

+1 vote

I have a main domain (of course) and a sub domain. I'm really trying to steer my personal stuff away from the main one and have focused all of my php development to the sub-domain.

Lately I noticed that google catalogs my sub-domain site stuff under the main domain name and the links that come up lead to that domain name with the path that takes the user to the sub-domain's home folder and beyond.

Is there something that php (apache??) can do to control either google's robots or the user's view (url) so that it appears as a page of my sub-domain?

+1 vote

I'm trying to use D3, a javascript data visualization library in my rails app. The problem is that I can't figure out where to put the d3.js source and my .json data so that rails will serve it.

My problem is in the way d3 issues a GET request when it looks for my json and d3.js files.

Things I tried:- setting up a static pages folder that is served with high_voltage gem. This didn't work for me as I couldn't get around my application layout so it wrapped my js and json in html. I think this is why this didn't work.- putting the files to be served in the public folder. This didn't work because it couldn't find the routes for the public folder. I did turn on config.serve_static_assets in the production enviroment config file.
I feel like this question should have a simple answer as everything works perfectly if I put my html, json and d3.js files into a folder and start a simple python http server in that folder. I think my problem is in my understanding of the way rails is trying to serve things.

...