Send user to external site with post method like post form

Hello, I want to send my user to external site with post method and some params, the main way is I should create a post form and let the user push the button, but I don’t want it, because I’m forced to input some private params in html hidden form.
now how can I create a router that after calling it, it is redirected to external site but like a post form?

The external site can’t take encode params!


IMHO, you can use AJAX POST and let javascript redirect your user to other site

1 Like

I used it <body onload='document.forms["form"].submit()'> but not safe, I don’t know AJAX but I can test your suggestions.

1 Like

There is no way to create a post redirect in the backend side. You have to render an HTML form with hidden fields and, by Javascript, trigger submit action.

Yes, it is unsafe indeed! Clients can disable javascript execution on browser, change hidden fields values and do the submit. To avoid it, would be more correct the external source provides a GET URL with some headers over HTTPS enabling you to do the redirect directly by the backend.