开发者

JavaScript history.go and load balancer question

开发者 https://www.devze.com 2023-02-22 18:05 出处:网络
I have a web application that I have recently place behind a load balancer.There is a page that has the javascript:history.go(-1) method in a link.The previous page is a form that performs a submit.Wh

I have a web application that I have recently place behind a load balancer. There is a page that has the javascript:history.go(-1) method in a link. The previous page is a form that performs a submit. When I click on the link that performs the go method, going to the server directly, does not try to resubmit the form. But when I click on the same link through the load balancer the form does a resub开发者_Python百科mit. Does anyone have any ideas on how to perform this task through a load balancer so the link does not resubmit the page?


This behavior could be caused by not having "sticky sessions" enabled in the Load Balancer. It wouldn't know the resulting page load from the go is coming from the same user, so instead of simply displaying the page, it's re-serving it.

Do you know if it has "sticky sessions" enabled or if that's an option?


If possible, use the Post/Redirect/Get pattern for the "previous" page. In other words - process the POST request and instead of returning a result redirect to another page. It will be loaded using GET and the form won't be re-submitted upon navigating back to it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号