문제

How do I get the Origin request header from cross-domain AJAX requests in Rails?

도움이 되었습니까?

해결책

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.

다른 팁

It seems like request.origin also works directly in recent rails versions. (at least Rails 6)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top