Skip to content

Commit dc5131d

Browse files
committed
autogen(docs): generate cli docs
1 parent 9d57e29 commit dc5131d

File tree

2 files changed

+65
-19
lines changed

2 files changed

+65
-19
lines changed

docs/cli/ory-proxy.md

Lines changed: 63 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,60 @@ This proxy works both in development and in production, for example when deployi
2020
React, NodeJS, Java, PHP, ... app to a server / the cloud or when developing it locally
2121
on your machine.
2222

23+
The first argument `application-url` points to the location of your application. The Ory Proxy
24+
will pass all traffic through to this URL.
25+
26+
$ ory proxy --project <your-project-slug> https://www.example.org
27+
$ ORY_PROJECT_SLUG=<your-project-slug> ory proxy http://localhost:3000
28+
29+
### Connecting to Ory
30+
2331
Before you start, you need to have a running Ory Cloud project. You can create one with the following command:
2432

2533
$ ory create project --name "Command Line Project"
2634

27-
Pass the project's slug as a flag to the tunnel command:
35+
Pass the project's slug as a flag to the proxy command:
2836

2937
$ ory proxy --project <your-project-slug> ...
3038
$ ORY_PROJECT_SLUG=<your-project-slug> ory proxy ...
3139

32-
The first argument `app-url` points to the location of your application. If you are
33-
running the proxy and your app on the same host, this could be localhost.
40+
### Developing Locally
41+
42+
When developing locally we recommend to use the `--dev` flag, which uses a lax security setting:
43+
44+
$ ory proxy --dev \
45+
--project <your-project-slug> \
46+
http://localhost:3000
3447

35-
The second argument `[publish-url]` is optional. It refers to the public URL of your
36-
application (e.g. https://www.example.org).
48+
The first argument `application-url` points to the location of your application. If you are
49+
running the proxy and your app on the same host, this could be localhost. All traffic arriving at the
50+
Ory Proxy will be passed through to this URL.
51+
52+
The second argument `[publish-url]` is optional and only needed when going to production.
53+
It refers to the public URL of your application (e.g. https://www.example.org).
3754

3855
If `[publish-url]` is not set, it will default to the default
3956
host and port this proxy listens on:
4057

4158
http://localhost:4000
4259

60+
### Running on a Server
61+
62+
To go to production set up a custom domain (CNAME) for Ory. If you can not set up a custom
63+
domain - for example because you are developing a staging environment - using the Ory Proxy is an alternative.
64+
4365
You must set the `[publish-url]` if you are not using the Ory Proxy in locally or in
4466
development:
4567

46-
$ ory proxy --project <your-project-slug> \
68+
$ ory proxy \
69+
--project <your-project-slug> \
4770
http://localhost:3000 \
4871
https://example.org
4972

5073
Please note that you can not set a path in the `[publish-url]`!
5174

75+
### Ports
76+
5277
Per default, the proxy listens on port 4000. If you want to listen on another port, use the
5378
port flag:
5479

@@ -62,15 +87,21 @@ If your public URL is available on a non-standard HTTP/HTTPS port, you can set t
6287
http://localhost:3000 \
6388
https://example.org:1234
6489

90+
### Multiple Domains
91+
6592
If this proxy runs on a subdomain, and you want Ory's cookies (e.g. the session cookie) to
6693
be available on all of your domain, you can use the following CLI flag to customize the cookie
67-
domain:
94+
domain. You will also need to allow your subdomains in the CORS headers:
6895

6996
$ ory proxy --project <your-project-slug> \
7097
--cookie-domain example.org \
98+
--allowed-cors-origins https://www.example.org \
99+
--allowed-cors-origins https://api.example.org \
71100
http://127.0.0.1:3000 \
72101
https://ory.example.org
73102

103+
### Redirects
104+
74105
Per default all default redirects will go to to `[publish-url]`. You can change this behavior using
75106
the `--default-redirect-url` flag:
76107

@@ -82,12 +113,14 @@ the `--default-redirect-url` flag:
82113
Now, all redirects happening e.g. after login will point to `/welcome` instead of `/` unless you
83114
have specified custom redirects in your Ory configuration or in the flow's `?return_to=` query parameter.
84115

116+
### JSON Web Token
117+
85118
If the request is not authenticated, the HTTP Authorization Header will be empty:
86119

87120
GET / HTTP/1.1
88121
Host: localhost:3000
89122

90-
If the request was authenticated, a JSON Web Token will be sent in the HTTP Authorization Header containing the
123+
If the request was authenticated, a JSON Web Token can be sent in the HTTP Authorization Header containing the
91124
Ory Session:
92125

93126
GET / HTTP/1.1
@@ -123,19 +156,33 @@ An example payload of the JSON Web Token is:
123156

124157

125158
```
126-
ory proxy app-url [publish-url] [flags]
159+
ory proxy application-url [publish-url] [flags]
160+
```
161+
162+
### Examples
163+
164+
```
165+
ory proxy http://localhost:3000 --dev
166+
ory proxy http://localhost:3000 https://app.example.com \
167+
--allowed-cors-origins https://www.example.org \
168+
--allowed-cors-origins https://api.example.org \
169+
--allowed-cors-origins https://www.another-app.com
170+
127171
```
128172

129173
### Options
130174

131175
```
132-
--cookie-domain string Set a dedicated cookie domain.
133-
--default-redirect-url string Set the URL to redirect to per default after e.g. login or account creation.
134-
-h, --help help for proxy
135-
--no-jwt Do not create a JWT from the Ory Kratos Session. Useful if you need fast start up times of the Ory Proxy.
136-
--open Open the browser when the proxy starts.
137-
--port int The port the proxy should listen on. (default 4000)
138-
--project string The slug of your Ory Cloud Project.
176+
--allowed-cors-origins strings A list of allowed CORS origins. Wildcards are allowed.
177+
--cookie-domain string Set a dedicated cookie domain.
178+
--debug Use this flag to debug, for example, CORS requests.
179+
--default-redirect-url string Set the URL to redirect to per default after e.g. login or account creation.
180+
--dev Use this flag when developing locally.
181+
-h, --help help for proxy
182+
--no-jwt Do not create a JWT from the Ory Kratos Session. Useful if you need fast start up times of the Ory Proxy.
183+
--open Open the browser when the proxy starts.
184+
--port int The port the proxy should listen on. (default 4000)
185+
--project string The slug of your Ory Cloud Project.
139186
```
140187

141188
### SEE ALSO

docs/cli/ory-tunnel.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ Tunnel Ory on a subdomain of your app or a separate port your app's domain
1515

1616
### Synopsis
1717

18-
1918
This command runs an HTTP Server which is connected to Ory's APIs, in order for your application and Ory's
2019
APIs to run on the same top level domain (for example yourapp.com, localhost). Having Ory on your domain
2120
is required for cookies to work.
2221

2322
The first argument `application-url` points to the location of your application. This location
2423
will be used as the default redirect URL for the tunnel, for example after a successful login.
2524

26-
$ ory tunnel https://www.example.org --project <your-project-slug>
27-
$ ory tunnel http://localhost:3000 --project <your-project-slug>
25+
$ ory tunnel --project <your-project-slug> https://www.example.org
26+
$ ORY_PROJECT_SLUG=<your-project-slug> ory tunnel http://localhost:3000
2827

2928
### Connecting to Ory
3029

0 commit comments

Comments
 (0)