是否可以对两个单独的服务器执行后期操作
我正在经营一家网上商店,我正在尝试将“购买”(这是一种形式的“发布”操作)发布到两个单独的服务器(一个本地服务器和一个远程服务器)......我认为这可能是不可能的,但是我正在寻找明确的答案。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将 HTTP POST 定向到“代理”,该代理立即执行您想要的两个单独的帖子(可能看起来有点复杂,让本地服务器在收到本地帖子后执行远程帖子,但它的优点是您不需要不需要触及服务器代码中的一点点——每个服务器都不需要知道其“兄弟”服务器也接收相同的 POST)。 HTTP 始终基于每个事务“一个客户端,一个服务器”,但是像这样的类似代理的实体可以用来放宽这一限制。
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.
假设您正在从浏览器进行发布,并且浏览器可以运行 javascript,那么您肯定可以将相同的表单发布到多个服务器。如果不可能在浏览器上使用 javascript,那么您将无法仅使用浏览器发布到多个服务器。
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.