<@U04UQ68083H> is it possible to use an ory tunnel...
# ory-copilot
b
@chilly-king-10285 is it possible to use an ory tunnel running on localhost to set a cookie on a different domain?
b
A message from kapa.ai
Based on the knowledge sources provided, it is not possible to use an Ory Tunnel running on localhost to set a cookie on a different domain. This is due to fundamental browser security measures and how HTTP cookies work. The Ory Tunnel is designed to make Ory APIs and your application available on the same domain during local development. As stated in the [Ory Tunnel documentation](https://www.ory.sh/docs/cli/ory-tunnel): "To make Ory APIs and your application available on the same domain, Ory Tunnel mirrors Ory endpoints and rewrites cookies to match the domain correct domain." However, browsers have strict rules about setting cookies across different domains. As explained in the [HTTP cookies section of the Ory security model documentation](https://www.ory.sh/docs/security-model#http-cookies): "If you make a request to
<https://www.my-evil-app.com>
and the server responds with
Set-Cookie: google_session=1234; domain=<http://google.com|google.com>
, the browser rejects the cookie." This means that even if you're using the Ory Tunnel on localhost, it cannot set cookies for a different domain due to browser security restrictions. Furthermore, the [Cookie settings documentation](https://www.ory.sh/docs/kratos/guides/configuring-cookies) emphasizes: "HTTP Cookies aren't port specific. If a cookie is set on
<https://mydomain.com:1234>
it's also valid for
<https://mydomain.com:4321>
and
<https://mydomain.com>
." This reinforces that while the Ory Tunnel can help with local development by allowing your app and Ory to run on the same domain (localhost), it cannot bypass the fundamental domain restrictions for cookie setting imposed by web browsers.