You have a trailing slash in the $url variable in the PHP code. That won't work, because you don't have a trailing slash in your Flask code. Look here for more info, under the section "Unique URLs / Redirection Behavior"
$url