33 Commits

Author SHA1 Message Date
robobun
908ab9ce30 feat(fetch): add proxy object format with headers support (#25090)
## Summary

- Extends `fetch()` proxy option to accept an object format: `proxy: {
url: string, headers?: Headers }`
- Allows sending custom headers to the proxy server (useful for proxy
authentication, custom routing headers, etc.)
- Headers are sent in CONNECT requests (for HTTPS targets) and direct
proxy requests (for HTTP targets)
- User-provided `Proxy-Authorization` header overrides auto-generated
credentials from URL

## Usage

```typescript
// Old format (still works)
fetch(url, { proxy: "http://proxy.example.com:8080" });

// New object format with headers
fetch(url, {
  proxy: {
    url: "http://proxy.example.com:8080",
    headers: {
      "Proxy-Authorization": "Bearer token",
      "X-Custom-Proxy-Header": "value"
    }
  }
});
```

## Test plan

- [x] Test proxy object with url string works same as string proxy
- [x] Test proxy object with headers sends headers to proxy (HTTP
target)
- [x] Test proxy object with headers sends headers in CONNECT request
(HTTPS target)
- [x] Test proxy object with Headers instance
- [x] Test proxy object with empty headers
- [x] Test proxy object with undefined headers
- [x] Test user-provided Proxy-Authorization overrides URL credentials
- [x] All existing proxy tests pass (25 total)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-26 15:11:45 -08:00
Michael H
4450d738fa docs: more consistency + minor updates (#24764)
Co-authored-by: RiskyMH <git@riskymh.dev>
2025-11-21 14:06:19 -08:00
Michael H
87eca6bbc7 docs: re-apply many recent changes that somehow aren't present (#24719)
lots of recent changes aren't present, so this reapplies them
2025-11-16 19:23:01 +11:00
Lydia Hallie
1606a9f24e Replace old docs with new docs repo (#24201) 2025-11-05 11:14:21 -08:00
Jarred Sumner
55a9cccac0 bun.sh -> bun.com (#20909) 2025-07-10 00:10:43 -07:00
Michael H
2bc70df266 minor guide fixes for consistency (#16273) 2025-01-11 06:38:41 +00:00
Pham Minh Triet
d5a118e25f Fix(doc): update cluster.md (#15214) 2024-11-18 03:04:36 -08:00
Jarred Sumner
80cb9e77bc Use absolute links in docs 2024-09-10 15:11:16 -07:00
Roman
9993d72fee docs: remove extra assignment (#13389) 2024-08-18 10:52:00 -07:00
Kelvin Luck
dcec6906f6 Prefer import.meta.path in http server guide (#11180) 2024-05-19 13:37:17 -07:00
Jarred Sumner
8fbdf32d74 Update cluster.md 2024-05-14 02:18:04 -07:00
Jarred Sumner
41569fa369 Update cluster.md 2024-05-14 01:57:43 -07:00
Jarred Sumner
5602b7a352 Update cluster.md 2024-05-14 01:56:55 -07:00
Jarred Sumner
e686c2ed7b Add guide for reusePort 2024-05-14 01:53:52 -07:00
Jarred Sumner
3fc2e45960 Update proxy.md 2024-05-01 03:19:30 -07:00
Jarred Sumner
50ba690cad Update proxy.md 2024-05-01 03:17:06 -07:00
Jarred Sumner
2b193095d3 Update proxy.md 2024-05-01 03:16:27 -07:00
Jarred Sumner
e1a7fe55c3 Add guide for proxy 2024-05-01 03:14:25 -07:00
Jarred Sumner
c5270f8121 Fix typo 2024-04-18 22:57:36 -07:00
Jarred Sumner
2ce83953e5 [docs] Add a few more guides 2024-04-18 22:20:29 -07:00
Jarred Sumner
b6aebb58c2 [doc] Add guide for streaming with async iterators 2024-04-18 22:09:09 -07:00
Jarred Sumner
dd920dadb8 Shorten title 2024-03-06 15:34:18 -08:00
Jarred Sumner
f6d5325daa Support socketPath in node:http request (#9284)
* Support `socketPath` in node:http request

* fix dashes

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: dave caruso <me@paperdave.net>
2024-03-06 15:28:35 -08:00
Lucas Garron
7909f0eff4 Fix typo: demonstates → demonstrates (#9179) 2024-03-01 05:44:44 -08:00
Jake Gordon
099825e5ac Common HTTP server usage guide (#8732)
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
2024-02-15 16:30:59 -08:00
Moris Kramer
ee85bbc0a3 Update simple.md (#7987)
* Update simple.md

* Update docs/guides/http/simple.md

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-04 16:59:01 -08:00
Samuel Rigaud
263382103f docs: fix typos (#5151) 2023-09-12 18:50:05 -07:00
ped
f9d2e687f5 Fix typo in http file upload example (#5088) 2023-09-12 08:30:06 -07:00
Karl Böhlmark
db2faf7c5b docs: fix http simple example log statement (#4320)
Co-authored-by: Karl Böhlmark <karl.bohlmark@netinsight.net>
2023-09-01 23:49:50 -07:00
Colin McDonnell
177e02b304 docs: hot reloading with Bun.serve 2023-08-28 12:55:22 -07:00
Colin McDonnell
404b90badc Add ecosystem guides (#3847)
* Add ecosystem guides

* Update titles

* Rename stric

* Add unlink and fetch guides

* Add formdata guide

* Tweak title

* Moar
2023-07-31 12:20:23 -07:00
Colin McDonnell
34fd4df646 Fix broken anchors 2023-07-26 17:11:15 -07:00
Colin McDonnell
4c89c60867 Add files (#3826) 2023-07-26 14:59:39 -07:00