Is it possible to do a post action to two separate servers

删除回忆录丶 提交于 2020-01-06 01:59:05

问题


I'm running an online shop and I'm trying to have the "purchase" (which is a form "post" action) post to two separate servers (one local and one remote) ... I think this might be impossible but I'm looking for a definitive answer.


回答1:


You could direct the HTTP POST to a "proxy" which immediately does the two separate posts you want (may seem a bit convoluted, wrt having the local server perform the remote post upon receiving the local post, but it has the advantage that you don't need to touch one bit in the servers' code -- each of them need have no knowledge about its "sibling" server also receiving the same POST). HTTP is always based on "one client, one server" per transaction, but proxy-like entities like this one may be used to relax this restriction.




回答2:


Assuming you are doing the post from a browser and assuming that the browser can run javascript, then you could definitely post the same form to more than one server. If using javascript on the browser is not a possibility, then you won't be able to post to more than one sever using just the browser.



来源:https://stackoverflow.com/questions/2346110/is-it-possible-to-do-a-post-action-to-two-separate-servers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!