2016-06-27 3 views
1

레일 4의 일부 사용자 지정 HTTP 헤더에 액세스하려고합니다.apache_request_headers와 동일한 레일에서 HTTP 헤더에 액세스하는 방법?

절망적 인 부분. php apache_request_headers() 함수를 사용할 때 해당 사용자 정의 헤더를 가져올 수 있지만 레일 4의 해당 헤더에 액세스 할 수 없습니다.

나는 지금까지 해봤습니다.

headers = ActionDispatch::Http::Headers.new(env)

더 많은 방법 request.headers.env["header_name"]

request.headers["HTTP_header_name"]

request.headers["header_name"]

request.headers하지만 헤더에 액세스하는 데 실패합니다. 그래서 나는 무엇인가 놓치고 있냐? 내가와 ApplicationController

HomeController

class HomeController < ApplicationController 
    def index 
    end 
end 

에 액세스 할 수

class ApplicationController < ActionController::Base 
    before_action :sso_handler, :only => [:index, :show] 

    ... 

    def sso_handler 
     //all above commands i tried here. 
    end 
end 

을 시도

장소 그래서 나는 PHP에서 헤더에 액세스 할 수 있습니다 아무 생각이 왜, 왜 내가 할 수있는 Rails 4에 액세스 할 수 없습니다.

답변

관련 문제