-400 error when navigating Back and Forward after POST requ

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

-400 error when navigating Back and Forward after POST requ

Postby Czarek » Tue Oct 28, 2014 5:44 am

I'm getting -400 error (CACHE_MISS) when navigating Back and then Forward in navigation history after a POST request was made. What is the best way to resend the POST request when navigating in browser history? I've tried calling Reload() in OnLoadError(), but it causes history navigation to be broken, the entry before POST request disappears from navigation history.

Here are the steps in my app (branch 1650):
1. GET index.php
2. GET foo.php
3. POST foo.php?bar=1
4. Back()
5. Forward() - OnLoadError is called with -400 error.
a) Doing Back() in that callback takes us to step 1) GET index.php.
b) Doing Reload() resents the post request, repeats step 3) POST foo.php

What happens after 5) > b):
6. Calling Back() takes us back to step 1) GET index.php

What should happen after 5) > b):
6. Calling Back() should take us back to step 2) GET foo.php

Here are the steps in cefclient (branch 2170):
(steps 1-4 are the same)
1. GET index.php
2. GET foo.php
3. POST foo.php?bar=1
4. Back()
5. Forward() - Getting error "Failed to load URL http://127.0.0.1:54305/foo.php?bar=1 with error (-400).".
6. Back() takes us back to step 2) GET foo.php
7. Forward() - resents the 3) request but with GET method instead of POST. It makes GET foo.php?bar=1

What I would like is to:
1) Resend the original POST request when doing Back/Forward navigation. I don't want to display -400 error message to user
2) Not to lose any navigation history.

Any ideas on how to accomplish this?
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: -400 error when navigating Back and Forward after POST r

Postby magreenblatt » Tue Oct 28, 2014 8:28 am

How does it currently behave in Google Chrome?
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: -400 error when navigating Back and Forward after POST r

Postby Czarek » Tue Oct 28, 2014 8:47 am

In Google Chrome clicking Back/Forward from context menu displays page that was submitted using POST request just fine. It seems that page is displayed from cache, as I don't see any GET or POST requests in web server logs. When clicking F5 Reload in Google Chrome a dialog appears "Confirm Form Resubmission" and then I see in web server logs that form data was resubmitted.

Regarding calling Reload() or ReloagIgnoreCache() from inside the OnLoadError callback - it doesn't work all the time. After clicking a few times back/forward the page hangs, a white screen is displayed. From logs I can see that OnLoadingStateChange is called with loading=1, but the next call with loading=0 never arrives. Mouse cursor indicator shows loading and it hangs forever with a blank screen.

Testing on Windows 7 64bit.

UPDATE. Another issue. Calling ReloadIgnoreCache() on a page that was submitted using POST request does nothing. No callbacks from CefRequestHandler are being called.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: -400 error when navigating Back and Forward after POST r

Postby magreenblatt » Tue Oct 28, 2014 8:54 am

Please add a bug report.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: -400 error when navigating Back and Forward after POST r

Postby Czarek » Tue Oct 28, 2014 9:12 am

Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: -400 error when navigating Back and Forward after POST r

Postby luannhq » Mon Jan 12, 2015 10:19 pm

Hi all,

I have project use Cef load my website have some page load by post method.
I try use
setting.CefCommandLineArgs.Add("disable-application-cache", string.Empty) when initial, Reload without cache but don't work.

Could you give me some suggestion or trick to resolve this problem, please?

Thanks and best regards
luannhq
Newbie
 
Posts: 1
Joined: Mon Jan 12, 2015 10:12 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 47 guests