Hi all! I was playing around with ory cloud, I hav...
# ory-network
c
Hi all! I was playing around with ory cloud, I have a sample react app to test out the OIDC flow with an Oauth client that I created on the ory cloud developer console. I know ory does not allowed you to add
localhost
to allowed domains for CORS, so I exposed my react app through ngrok to test. I've added the ngrok domain to my CORS on the UI as shown below, but I still get a CORS error. Has anyone faced this issue before?
m
Hm I think you still have the same issue with ngrok. But AFAIK there is a workaround using Cloudflare Tunnel:
Copy code
It allows to do something similar to ngrok by exposing local app/services to the web but it's free to use custom domain.
Here how it works:
I created a free ory project to test this, and I tried the following configuration:
1) Cloudflare tunnels
<https://custom1.domain.com>  => <http://localhost:3000> (our app)
<https://custom2.domain.com>  => <http://localhost:4000> (ory tunnel)
2) Ory tunnel
SDK URL in our app
ORY_URL=<https://custom2.domain.com>
ORY_PROXY_URL=<http://custom2.domain.com|custom2.domain.com>
ORY_SCHEME=https
Ory tunnel
ory tunnel <https://custom1.domain.com> <https://custom2.domain.com> --allowed-cors-origins <https://custom1.domain.com> --project xxxxxxxxxxxxxxxxxxxx --debug --cookie-domain <http://domain.com|domain.com> --dev
Let me know if that is something that could work for you @careful-flower-71235
c
Hi @magnificent-energy-493, thanks for helping! I'll try out your method too. I was eventually able to get it working by patching the ory networking config, by running this command:
Copy code
ory patch project f5c3c1de-bffe-4bc4-9e8d-2edfd776330d \
  --replace '/cors_public/enabled=true' \
  --replace '/cors_public/origins=["https://*.<http://ngrok-free.app|ngrok-free.app>"]'
After running this command, it started working. But I can't find these configs on the ory console, is it not available via the UI yet?
m
Yes that is possible! We are adding configs to the UI bit by bit; and many configs are not often used. In this case I think its fine that it is not in the UI (what is your opinion on that?) But it would be great to document this approach! If you can jot me over some rough notes what you did I would be happy to turn it into a docs page!
c
Sure, I'll dm you what I tried. 😄
❤️ 1