Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the HTTP_HOST from Rails?

I need to set some server specific variables in a rails application that will run on at least two different servers. What is the best way to get the request's HTTP_HOST value in order to know what is the current server and set these variables accordingly? I'm using Apache 2 with Passenger.

like image 838
zero_padded Avatar asked Dec 29 '22 16:12

zero_padded


1 Answers

Think you're looking for request.env["SERVER_ADDR"].

like image 62
hgmnz Avatar answered Jan 05 '23 17:01

hgmnz