1

I am creating a rails application where we have functionality for registering a new User is there and there we are providing separate sub domain for each user by their user name. so i want to map user_name.localhost:3000.com where user_name is dynamic

Sam
  • 1,623
  • 1
  • 19
  • 31
  • You need to adjust your local "hosts" file. See this http://stackoverflow.com/questions/138162/wildcards-in-a-hosts-file – Bala Feb 05 '14 at 11:35
  • I am using ubuntu system not windows . So for that what has to be done. – Sam Feb 05 '14 at 11:37
  • You could use [xip.io](http://xip.io): `user_name.127.0.0.1.xip.io:3000` should work – Stefan Feb 05 '14 at 12:26

3 Answers3

2

Run your local development server with pow. If you symlink the app to the foo, than your pages are available under http://foo.dev, but also under every other subdomain like http://bar.foo.dev. There is no need to register a list of subdomains somewhere.

prax might be an alternative when you are on linux.

spickermann
  • 100,941
  • 9
  • 101
  • 131
1

Access like this. No configuration required

user_name.lvh.me:3000
Santhosh
  • 28,097
  • 9
  • 82
  • 87
0

I have figured it out. Actually the application is using subdomain_fu gem for creation of the subdomain and when the user is created the subdomain is name is saved in the db and the can accessed by making configuration into the file C:\Windows\System32\drivers\etc\hosts and map the ip which is being hit like ;

192.xxx.xx.xxx           user_name.your_subdomain _name

and hit the url like this ;

user_name.your_subdomain _name:3000

It is working fine with me doing these steps. Thanks to all for their valuable feed back.

Sam
  • 1,623
  • 1
  • 19
  • 31