问题
How do I get the Origin request header from cross-domain AJAX requests in Rails?
回答1:
You can achieve this in the controller by using:
request.headers['origin']
Note: You will need to make certain changes in certain config files for your application to be able to respond to a CORS request. Hope you've got that covered.
来源:https://stackoverflow.com/questions/22812477/how-to-get-origin-request-header-in-rails