Minor Proxy Improvements (#1289)

* fix(serve): provide a clear error with pathless proxy URLs

Without this, `dx serve` panics with this message:

```
Paths must start with a `/`. Use "/" for
 root routes
 ```

 That's not very clear. Instead, we can detect this situation and provide a better error message:

```
Error: 🚫 Serving project failed: Failed to establish proxy: Proxy backend URL must have a non-empty path, e.g. http://localhost:8080/api instead of http://localhost:8080
```

* docs(config): correct format for `web.proxy`
This commit is contained in:
Brian Donovan authored and GitHub committed 2023-08-04 13:44:56 -05:00
1 parent 50230b6f71
commit 6d154b5072
3 files changed
+33 -3

No files matched your search

+3
View File
@@ -35,6 +35,9 @@ pub enum Error {
#[error("Invalid proxy URL: {0}")]
InvalidProxy(#[from] hyper::http::uri::InvalidUri),
#[error("Failed to establish proxy: {0}")]
ProxySetupError(String),
#[error("Error proxying request: {0}")]
ProxyRequestError(hyper::Error),