RoR 3 - Registering domains for my clients - ruby

I am building a RoR3 site that generates a microsite for each client. At this moment they enter to their microsite using the url www.site.com/clientid , but I want to register their own domain programatically, so they will enter to www.clientid.com and they will be redirected to my server. Is there any way to do that?

Have the client point the domain to your IP using the DNS management interface of the registrar. (More technically this would result in the creation of an A record or an AAAA record but this is not your concern).
Once the DNS is propagated, entering www.clientid.com in the browser will make a request to your server (your rails app). There you can selectively serve content based on the domain.
class ApplicationController
before_filter do
#current_account = Account.find_by_domain(request.domain)
end
end

Related

Why is my Google domain not directing to https?

I deployed an app on Heroku and set up automatic SSL configuration. According to my Heroku, my app can be accessed via https. If I use that URL, the connection is indeed secure.
I added a Synthetic Recored in my google domain to point to this url. I also added a Custom Resource Record where the Name is www, Type is CNAME, and Data is my DNS Target for the app.
I can only connect securely when I use https://www.osrshub.com. If I use www.osrshub.com or osrshub.com, it is not secure. What am I doing wrong?
The comment from user2864740 is correct. I needed to update my front end to redirect to https.
Force SSL/HTTPS with mod_rewrite

Amazon Route53 redirection

I have a domain example.com in AWS and have got one load balancer and one ec2 instance. Trying to setup https with certificate from AWS.
Route53 setup and A record setup is done as follows for domain to load balancer.
domain name - *.example.com
Name:-
example.com.
Type:-
- Ip4
Alias Target :- dns name of load balancer.
My web is a spring based web and it redirect user to landing page if user access www.example.com --->>> www.example.com/landing.
After all the setup, if i access like the below url, it is working fine.
https://www.example.com/landing
But if i access without www,
https://example.com/landing --> It leads to browser security page.(Your connection is not private
Attackers might be trying to steal your information from ...)
Our certificate is based on the domain name *.example.com.
If I simply access, https://example.com/ ---> It gets redirected to http://example.com/landing -- > Spring app redirects like this with http.
http://www.test.com/landing leads to certificate trust error. (https://example.com/landing).
Getting site can not be reached error if i simply access, http://www.example.com/
I am looking for URL redirection to https if user access using http or without www or without any scheme. Not sure if i have to configure anything in Route53.
Also, Do i need to configure in my app to redirect to https?
Your current certificate should not work for the root, i.e. https://test.com
Either purchase an alternate name for https://test.com or use only www.test.com as your website. You do not need to change anything in Route53 for now. You probably do need to add redirection in your webserver/app to use HTTPS-only, unless you want to leave it to the users.

Multiple Domains on single grails application and second domain only with access to one specific controller?

I have a grails 2.2.2 application and i want to have two domains connected with it.
Domain.tld and shop.domain.tld.
Requests over domain.tld aren't allowed to access to ShopController. Only shop.domain.tld should have access to ShopController, but to no other Controller of the application.
I also want to use the grails url-rewriting. Is there a possibility to implement such use-case with grails? If yes, how would you implement it?
In the end i want that for example each online shop can be accessed by
shop.domain.tld/ID
and not by domain.tld/shop/myShop/ID. domain.tld is supposed to other purposes.
Thanks and best regards
If both domain points to the same server, and Tomcat is used for both as your public facing web server, then you just need to modify the part inside your Grails.
In Controller, you can check which domain was used to access your application:
def uri = new java.net.URI(request.getHeader("referer"))
def domainName = uri.getHost()

replace ip address with domain name in redirect

I have a Windows Server 2008 R2 virtual machine with IIS 7.5 hosting a ASP.NET MVC4 website. The WinServer has a public ip address. I also purchased a domain name. The domain name hosting company forwards requests to my server.
For example, when a customer types www.mycompany.com, the request is redirected to 217.151.XXX.XXX which is my server's public ip address.
When the customer is redirected to my server, everything is working. He sees a homepage in the web browser and with address www.mycompany.com in browser's address bar. However, when he browses through different pages in the websites and got redirected, the browser's address bar displays 217.151.xxx.xxx/order/detail instead of www.mycompany.com/order/detail.
I tired IIS url rewrite which rewrites 217.151.xxx.xxx/order/detail to www.mycompany.com/order/detail
But that results in the browser freezing, waiting for a response. My guess is that when IIS rewrites the url to www.mycompany.com/order/detail, it sends a request back to the domain name hosting company. The company interprets the request and redirects it back to 217.151.xxx.xxx which causes a infinite loop.
How can I have the domain name always displayed in the borwser's bar?
A very general issue when we map domain with IP
Check this out.
http://help.lockergnome.com/windows2/Domain-static-IP-mapping--ftopict485575.html

How can I direct a url to a subdomain?

I have a rails app that I host for multiple users as useraccount.mysite.com. I want to have the option to allow my users to have their own url (useraccount.com) but still host the app using my shared server. So they should be able to access useraccount.mysite.com or useraccount.com and it should return the same stuff. If they goto useraccount.com, the url should always say useraccount.com and they should never see mysite.com.
Is this possible?

Resources