at Route / of my page, the user can see a button:
<a href="[% h.url_for('post_route', param => someValue) %]" target="_blank"><button>click me</button></a>
A click on this button will open a new tab and do a post to the "post_route". in the controller sub of the post_route, i want to check some things and then redirect the user to a different domain, let's just say for example to www.redirecturl.com. I also need to send payload to www.redirecturl.com (post request). the domain www.redirecturl.com will then check the value i sent to it and render a specific page.
Unfortunately it doesn't work as expected.
If i use i.e. $self->redirect_to('www.redirecturl.com');
i get a "redirect error" in my browser with the information "This problem can sometimes occur when cookies are disabled or denied.".
So... any idea how i can redirect with Mojolicious to a completely different domain and send some payload in the body?
Thank you in advance
The documentation for redirect_to()
gives the following examples:
$c = $c->redirect_to('named', foo => 'bar');
$c = $c->redirect_to('named', {foo => 'bar'});
$c = $c->redirect_to('/index.html');
$c = $c->redirect_to('http://example.com/index.html');
From which, we can guess that if you want to redirect to a different domain, then you need to give it a complete URI - not just a domain name.