eliom icon indicating copy to clipboard operation
eliom copied to clipboard

Redirection service fail with post parameters

Open bruce-ricard opened this issue 8 years ago • 4 comments

I have a POST service (A) that takes POST parameters. I register this service as a Redirection, and I redirect towards a get service (B) that takes no parameters, after having done some server update (A is a service for someone to create a login for the site, so when he clicks OK on the registration page I register him and then redirect him toward the welcome page). I get this exception in my browser: Ocsigen_extensions.Ocsigen_http_error(_) but nothing in the server logs. The url in the browser is changed to the URL of B. When I try to reload the page, I get a "confirm form resubmission" message, like there are still POST parameters in the request, and if I hit OK it fails with the same Ocsigen_http_error message. If I just hit enter on the url it loads service B correctly. I changed A to be a service that takes only GET parameters, and transferred all my previous POST parameters to GET parameters, and it worked, B is not correctly my landing page.

It looks like the POST parameters passed to service A are transferred to service B during the redirection, and B doesn't like that.

bruce-ricard avatar Dec 16 '16 05:12 bruce-ricard

Please provide a small failing example. I tried to faithfully reproduce what you describe (code) and it seems to work.

vasilisp avatar Dec 16 '16 11:12 vasilisp

Your example looks very much like what I'm doing, except for 2 differences:

  • I'm using Eliom 5, I'm not sure if that makes a difference
  • I don't have the Eliom_client.change_page ~%redir_service () 0.Did you do that just to make your example shorter or if you do this every time you write a form? I might make a difference.

I'll try to extract a smallest failing example from my code.

bruce-ricard avatar Dec 16 '16 19:12 bruce-ricard

I don't have the Eliom_client.change_page ~%redir_service () 0.Did you do that just to make your example shorter or if you do this every time you write a form? I might make a difference.

I did that to see what happens if you call this service directly, without a form. I could have omitted it. There is a separate form right below.

vasilisp avatar Dec 16 '16 22:12 vasilisp

Here is my code. I have the get version here.

I just realized that I could fix the POST version by removing ~options:TemporaryRedirect from the redirection service registration. But the GET version works fine with TemporaryRedirect.

bruce-ricard avatar Dec 18 '16 00:12 bruce-ricard