CORS and finding the origin details
When you allow access from different origins and if you would like to know from which origin the request is from, you can get that information in
Once you get the origin url, you can get the host information (i.e., without http scheme and www) using the below snippet
And just fyi, to allow requests from any origin, set the below in after_action of AppilcationController
headers[‘Access-Control-Allow-Origin’] = ‘*'