2013-09-29 4 views
1

app.website.local을 내 로컬 호스트 127.0.0.1에 매핑하도록 etc/hosts를 수정했습니다. 이것은 작동하고 내 localhost로 리디렉션됩니다.레일 하위 도메인이 작동하지 않습니다.

문제는 request.subdomain이 비어있어서 아무 것도 할 수 없다는 것입니다.

class ApplicationController 
    before_filter :ensure_domain 

    private 

    def ensure_domain 
    # do something with the request 
    # here is request.subdomain empty 
    end 
end 

내 등/호스트 :

127.0.0.1 localhost 
255.255.255.255 broadcasthost 
::1    localhost 
fe80::1%lo0 localhost 
127.0.0.1 app.website.local 

답변

1

좋아 나는 문제를 스스로 해결했다. 나는 영국에서이 프로젝트를 시작했다. 도메인 이름에는 co.uk을 사용합니다. 그는 다음 구성을 development.rb에 추가했습니다.

config.action_dispatch.tld_length = 3 

이 행을 삭제하면 해결됩니다.

관련 문제