Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I accept post request only from a domain name?

I'm implementing a payment method on my application, and the bank site send back a post request with information about the payment, like the status, the payment id ...

But to be sure the request is not from someone trying to do bad stuff, can I accept only request from my bank system? I'm looking for something to check in the request for this action/controller is only from mybank.com and skip others.

like image 887
Ugo Mare Avatar asked Jan 09 '15 01:01

Ugo Mare


1 Answers

You can constrain the route:

post 'yourpath', to: 'controller#action', constraints: { protocol: 'https://', host: 'yourbank' }
like image 118
shweta Avatar answered Oct 08 '22 21:10

shweta