Webview goBack() issue, not redirecting to previous page after calling goBack()

Scenario:

  1. Load Profile page(main URL) in WebView.
  2. Then click on edit number link on Profile page which loads Edit number page.
  3. Edit number page is redirected to Authentication page.
  4. On Authentication page enter OTP and submit then redirected to Edit number page.
  5. On Edit number page, Enter new number and click on submit then it shows successes message with OK button.
  6. Then click on OK button redirected to Profile page(main URL).
  7. Now if click on back button and call webView.goBack() then it redirected to Authentication page while should be redirected to Edit number page.

Note: Same behavior is happening in android emulator WebView app also
While in Chrome browser it is redirecting to the Edit number page (Expected Behavior).

Expected Behavior: After clicking on Back button it should be redirected to the Edit Number page.

Observation:

Referral Header was wrong after executing point 7 (Referral Header on Edit Number page should be authentication page URL but we are getting Edit number page URL).

Expected Behavior: After clicking on Back button it should be redirected to the Edit Number page.