Open Links in Browser
DevSpace allows you to define URLs that should open after deploying an application in development mode, i.e. using devspace dev
.
The configuration for automatically opening URLs can be found in the dev.open
section of devspace.yaml
.
dev:
open:
- url: http://localhost:3000/
- url: http://localhost:8089/ # DevSpace UI
note
Setting dev.open
only affects devspace dev
. To open your application after running devspace deploy
, run devspace open
.
Workflow
- DevSpace starts to periodically send
HTTP GET
requests to the URLs provided viadev.open[*].url
. - As soon as the first HTTP response has a status code which is neither 502 (Bad Gateway) nor 503 (Service Unavailable), DevSpace assumes that the application is now started, stops sending any further requests and opens the provided URL in the browser.
- If the URL is still returning status code 502 or 503 after 4min, DevSpace will stop trying to open it. To not disturb the log streaming or the interactive terminal session, DevSpace will not show an error when hitting the 4min timeout.
Configuration
open
The open
option expects an array of auto-open configurations with exactly one of the following properties:
url
to open a URL in the default browser
Default Value For open
open: []
Example: Open URL when Starting Dev Mode
dev:
open:
- url: http://localhost:3000/login
Explanation:
Running devspace dev
using the above configuration would do the following:
- Build images and deploy the application
- Start port-forwarding and code-synchronization
- DevSpace opens the browser with URL
http://localhost:3000/login