Hi everyone Sorry I’m new to the group I have a question for you, I’m using rails 7 and I encountered a problem with checkout stripe that I can’t solve
in the command redirect_to @session.url
it gives me this error
Unsafe redirect to "https://checkout.stripe.com/pay/cs_test_a1Ca0a1zsA1qW6RO58aIJX9xg.......", pass allow_other_host: true to redirect anyway.
The error message you are seeing is asking you to do:
redirect_to @session.url, allow_other_host: true
I believe you are saying you tried:
redirect_to @session.url, 303
and you saw the “delete” error.
Rails has a method that it uses all over for extracting options from both hashes and arrays. I think that method (extract_options!) calls #delete on the options hash while extracting the key/value pairs from the object. I haven’t looked in the Rails code base for this issue, but I would bet that is what is happening here.
Basically, you are expected to pass an options hash, if anything, after the redirect url. You could do:
redirect_to @session.url, status: 303
to achieve what you wanted, but you will still get the same error. Since the domain you are redirecting to is not your own site, Rails is protecting you from a malicious user managing to redirect your users to some other site.
Thank you very much IT WORKS!
I’m sorry but I’m learning Ruby on rails, I’ve already made an application with rails 6 but I don’t know why it doesn’t work anymore. Now I’m porting it to rail 7 and I got stuck here, sorry for my poor English.
Thanks again