简体   繁体   中英

JavaScript history.go and load balancer question

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 resubmit. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM