Hi,
I am writing an application that uses subdomains for the different customers that access it. For example company1.mydomain.com and company2.mydomain.com.
I need to have portions of the application under ssl. I have attempted different ways of doing Including the following code in my application.rb:
def redirect_to_ssl
@cont = controller_name
@act = action_name
if !request.subdomains.first.nil? @subdomain = request.subdomains.first + '.' else @subdomain = '' end
redirect_to "https://#\{@subdomain}dnbformation.com/#{@cont}/#{@act}/#{params[:id]}" unless (@request.ssl? or local_request?)
end
This, however does not work, and i get an error stating that there are too many redirects.
What is the best way of accomplishing this. If need be I will make the entire site ssl, but I can't even figure out how to do that in the apache.conf because of the subdomains.
Any help would be great!
Thanks!
Ryan