I need to post form data from server A To B using AJAX to store the data on a database but I don't know how to achieve this securely to prevent cross site forgery attack.
How Do I do it? Is it possible to access server B only by server A?
Safest way would be to use iptables or hosts.allow/deny if your servers are runing on a unix-system. The apache module is platform independent. But beware to use #-comments in the configuration because this may make your server vulnerable https://vigilance.fr/vulnerability/Apache-httpd-rules-added-by-mod-access-compat-or-mod-authz-host-16636