Skip to content

Commit

Permalink
feat: clarify use of tunnel/proxy (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Oct 17, 2024
1 parent e018fb1 commit 43ed6ec
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
20 changes: 10 additions & 10 deletions cmd/cloudx/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ Per default, CORS is enabled for all origins.
### Connecting in automated environments
To connect the Ory Tunnel in automated environments, create a Project API Key for your project and set it as an environment variable:
To connect the Ory Tunnel in automated environments, create a Project API Key for your project, set it as an environment variable, and use the ` + "`--quiet`" + ` flag:
$ %[2]s=<project-api-key> {{.CommandPath}} tunnel ...
$ %[2]s=<project-api-key> {{.CommandPath}} -q ...
This will prevent the browser window from opening.
Expand All @@ -79,8 +79,8 @@ This will prevent the browser window from opening.
If you are using the Ory Proxy behind a gateway during development, you must set the ` + "`publish-url`" + ` argument:
$ {{.CommandPath}} --project <project-id-or-slug> \
http://localhost:3000 \
https://gateway.local:5000
http://localhost:3000 \
https://gateway.local:5000
Note: You cannot set a path in the ` + "`publish-url`" + `.
Expand All @@ -95,18 +95,18 @@ By default, the proxy listens on port 4000. To change this, use the ` + "`--port
If the proxy runs on a subdomain and you want Ory’s cookies (e.g., session cookies) to be accessible across all your domains, use the ` + "`--cookie-domain`" + ` flag to customize the cookie domain. Additionally, allow your subdomains in the CORS headers:
$ {{.CommandPath}} --project <project-id-or-slug> \
--cookie-domain gateway.local \
http://127.0.0.1:3000 \
https://ory.gateway.local
--cookie-domain gateway.local \
http://127.0.0.1:3000 \
https://ory.gateway.local
### Redirects
By default, all redirects will point to ` + "`publish-url`" + `. You can customize this behavior using the ` + "`--default-redirect-url`" + ` flag:
$ {{.CommandPath}} --project <project-id-or-slug> \
--default-redirect-url /welcome \
http://127.0.0.1:3000 \
https://ory.example.org
--default-redirect-url /welcome \
http://127.0.0.1:3000 \
https://ory.example.org
This ensures that all redirects (e.g., after login) go to ` + "`/welcome`" + ` instead of ` + "`/`" + `, unless you’ve specified custom redirects in your Ory configuration or via the flow’s ` + "`?return_to=`" + ` query parameter.
Expand Down
24 changes: 12 additions & 12 deletions cmd/cloudx/proxy/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ Before using the Ory Tunnel, ensure that you have a running Ory Network project.
Once your project is ready, pass the project's slug to the tunnel command:
$ {{.CommandPath}} --project <project-id-or-slug> ...
$ %[1]s=<project-id-or-slug> {{.CommandPath}} tunnel ...
$ %[1]s=<project-id-or-slug> {{.CommandPath}} ...
### Connecting in automated environments
To connect the Ory Tunnel in automated environments, create a Project API Key for your project and set it as an environment variable:
To connect the Ory Tunnel in automated environments, create a Project API Key for your project, set it as an environment variable, and use the `+"`--quiet`"+` flag:
$ %[2]s=<project-api-key> {{.CommandPath}} tunnel ...
$ %[2]s=<project-api-key> {{.CommandPath}} -q ...
This will prevent the browser window from opening.
Expand Down Expand Up @@ -82,9 +82,9 @@ If you need to run the tunnel behind a gateway during development, you can speci
Example:
$ {{.CommandPath}} --project <project-id-or-slug> \
https://www.example.org \
https://auth.example.org \
--cookie-domain example.org
https://www.example.org \
https://auth.example.org \
--cookie-domain example.org
Note: You cannot set a path in the `+"`tunnel-url`"+`.
Expand All @@ -103,17 +103,17 @@ If your application runs on a non-standard HTTP or HTTPS port, include the port
For cookie support, set the `+"`--cookie-domain`"+` flag to your top-level domain:
$ {{.CommandPath}} --project <project-id-or-slug> \
--cookie-domain example.org \
https://www.example.org \
https://auth.example.org
--cookie-domain example.org \
https://www.example.org \
https://auth.example.org
### Redirects
To specify a custom redirect URL, use the `+"`--default-redirect-url`"+` flag:
$ {{.CommandPath}} tunnel --project <project-id-or-slug> \
--default-redirect-url /welcome \
https://www.example.org`, client.ProjectKey, client.ProjectAPIKey),
$ {{.CommandPath}} --project <project-id-or-slug> \
--default-redirect-url /welcome \
https://www.example.org`, client.ProjectKey, client.ProjectAPIKey),

RunE: func(cmd *cobra.Command, args []string) error {
h, err := client.NewCobraCommandHelper(cmd)
Expand Down

0 comments on commit 43ed6ec

Please sign in to comment.