Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@ repo, and repeat the steps above._

#### Using a Remote StackRox Deployment

To point your local dev server at a remote Central, set `UI_START_TARGET` to
To point your local dev server at a remote Central, set `UI_START_TARGET` or `ROX_BASE_URL` to
the remote endpoint and start the dev server:

```sh
UI_START_TARGET=https://<central-ip>:443 npm run start
```

Note that `roxie` sets `$ROX_BASE_URL` in the environment automatically.

Prefer using a publicly accessible IP or load balancer for the remote Central.
`kubectl port-forward` can be used as a last resort if no accessible IP is
available, but it is unreliable — connections drop on machine sleep and under
Expand Down
12 changes: 10 additions & 2 deletions ui/apps/platform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ To start the local development server in watch mode, run `npm run start`.
The behavior of `npm run start` can be changed with the following environment variables:


#### UI_START_TARGET
#### UI_START_TARGET and ROX_BASE_URL
`UI_START_TARGET` will set the default endpoint that API requests are forwarded to from
the UI. By default the UI will forward API requests to `https://localhost:8000`.
the UI. If unset, `ROX_BASE_URL` will be used.
By default the UI will forward API requests to `https://localhost:8000`.

```sh
UI_START_TARGET=https://8.8.8.8:443 npm run start
Expand All @@ -28,6 +29,13 @@ will start the development server
and forward all API requests to `https://8.8.8.8:443`. _Note that the protocol (https) is required to
be set for this option._

Note that `roxie` sets `$ROX_BASE_URL` in the environment automatically in the subshell it launches
at the end of `deploy`. You can also enter one with `roxie shell` if you see errors such as:

```text
8:27:37 AM [vite] http proxy error: /v1/metadata
AggregateError [ECONNREFUSED]:
```

#### UI_CUSTOM_PROXIES

Expand Down
5 changes: 4 additions & 1 deletion ui/apps/platform/src/setupProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ export function viteProxy() {
parseCustomProxies().map(([path, target]) => [path, proxyWithTarget(target)])
);

const proxy = proxyWithTarget(process.env.UI_START_TARGET || 'https://localhost:8000');
const proxy = proxyWithTarget(
process.env.UI_START_TARGET ||
process.env.ROX_BASE_URL ||
'https://localhost:8000');

// Custom proxies come first so their (often more specific, possibly regex)
// paths take precedence over the generic catch-alls below. Vite matches proxy
Expand Down
Loading