<@U04UQ68083H> I get the error that `return_to URL...
# ory-copilot
v
@chilly-king-10285 I get the error that
return_to URL "/" is not allowed
when I try to open the login page on my custom domain. What could be the issue? Here is the error information
Copy code
"error": {
    "code": 400,
    "debug": "Allowed domains are: [{https   {{my_project_id}}.<http://projects.oryapis.com|projects.oryapis.com>   false false   } {https   <http://my-domain.net|my-domain.net>   false false   } {https   *.<http://my-domain.net|my-domain.net>   false false   } {http   *.<http://my-domain.net|my-domain.net>   false false   } {https   {{my_project_id}}.<http://projects.oryapis.com|projects.oryapis.com> /self-service  false false   }]",
    "id": "self_service_flow_return_to_forbidden",
    "message": "The request was malformed or contained invalid parameters",
    "reason": "Requested return_to URL \"/\" is not allowed.",
    "status": "Bad Request"
  },
c
A message from kapa.ai
The error message indicates that the
return_to
URL you're trying to use is not allowed. In Ory, the
return_to
URL is used to redirect the user after a flow (like login or registration) is completed. The
return_to
URL must be an allow-listed URL set in the project configuration. The URL must include the protocol and domain. Relative URLs aren't supported. The error message you're seeing suggests that you're trying to use a relative URL ("/") as the
return_to
URL, which is not allowed. You should use an absolute URL that includes the protocol and domain, and this URL must be in the allow list of your project configuration. For example, if you want to redirect the user to the home page of your application after login, you might use a
return_to
URL like
<https://myapp.com/home>
. You can set the
return_to
URL when you start a self-service flow. For example, when starting the login flow, you can append
?return_to=<https://myapp.com/home>
to the URL that starts the flow. Here's an example:
Copy code
bash curl -X GET 'http://<your-project>.<http://projects.oryapis.com/self-service/login/browser?return_to=https://myapp.com/home|projects.oryapis.com/self-service/login/browser?return_to=https://myapp.com/home>'
In this example, replace
<your-project>
with your project ID, and replace
<https://myapp.com/home>
with the URL you want to redirect the user to after login. For more information, refer to the [Ory documentation on browser redirects and flow completion](https://www.ory.sh/docs/concepts/redirects).