Skip to content

Commit 78d44cd

Browse files
committed
Simplify proxies doc
1 parent 6e33fe9 commit 78d44cd

File tree

2 files changed

+3
-200
lines changed

2 files changed

+3
-200
lines changed

browsers/proxies.mdx

Lines changed: 2 additions & 199 deletions
Original file line numberDiff line numberDiff line change
@@ -89,203 +89,6 @@ for i in range(5):
8989

9090
</CodeGroup>
9191

92-
## Best practices
93-
94-
### 1. Combine with stealth mode
95-
96-
When using proxies, always enable stealth mode for better bot detection avoidance:
97-
98-
<CodeGroup>
99-
100-
```typescript Typescript/Javascript
101-
const browser = await kernel.browsers.create({
102-
proxy_id: proxy.id,
103-
stealth: true
104-
});
105-
```
106-
107-
```Python Python
108-
browser = client.browsers.create(
109-
proxy_id=proxy.id,
110-
stealth=True
111-
)
112-
```
113-
114-
</CodeGroup>
115-
116-
### 2. Match proxy type to use case
117-
118-
Choose the appropriate proxy type based on your needs:
119-
120-
- **Mobile**: Best for avoiding detection, slowest
121-
- **Residential**: Great for avoiding detection, moderate speed
122-
- **ISP**: Good balance of speed and detection avoidance
123-
- **Datacenter**: Fastest but most easily detected
124-
- **Custom**: Use your own proxy infrastructure
125-
126-
### 3. Geographic consistency
127-
128-
Ensure proxy location matches your browser profile's location:
129-
130-
<CodeGroup>
131-
132-
```typescript Typescript/Javascript
133-
// Create a profile with US location
134-
const profile = await kernel.profiles.create({
135-
name: 'US User',
136-
locale: 'en-US',
137-
timezone: 'America/New_York'
138-
});
139-
140-
// Use a US proxy to match
141-
const proxy = await kernel.proxies.create({
142-
type: 'residential',
143-
config: {
144-
country: 'US',
145-
state: 'NY'
146-
}
147-
});
148-
149-
// Create browser with matching profile and proxy
150-
const browser = await kernel.browsers.create({
151-
profile_id: profile.id,
152-
proxy_id: proxy.id
153-
});
154-
```
155-
156-
```Python Python
157-
# Create a profile with US location
158-
profile = client.profiles.create(
159-
name='US User',
160-
locale='en-US',
161-
timezone='America/New_York'
162-
)
163-
164-
# Use a US proxy to match
165-
proxy = client.proxies.create(
166-
type='residential',
167-
config={
168-
'country': 'US',
169-
'state': 'NY'
170-
}
171-
)
172-
173-
# Create browser with matching profile and proxy
174-
browser = client.browsers.create(
175-
profile_id=profile.id,
176-
proxy_id=proxy.id
177-
)
178-
```
179-
180-
</CodeGroup>
181-
182-
## Proxy rotation strategies
183-
184-
### Sequential rotation
185-
186-
Rotate through proxies in order:
187-
188-
<CodeGroup>
189-
190-
```typescript Typescript/Javascript
191-
const proxies = await kernel.proxies.list();
192-
let currentIndex = 0;
193-
194-
function getNextProxy() {
195-
const proxy = proxies[currentIndex];
196-
currentIndex = (currentIndex + 1) % proxies.length;
197-
return proxy;
198-
}
199-
200-
// Use different proxy for each task
201-
for (const task of tasks) {
202-
const proxy = getNextProxy();
203-
const browser = await kernel.browsers.create({
204-
proxy_id: proxy.id
205-
});
206-
await performTask(browser, task);
207-
await browser.close();
208-
}
209-
```
210-
211-
```Python Python
212-
proxies = client.proxies.list()
213-
current_index = 0
214-
215-
def get_next_proxy():
216-
global current_index
217-
proxy = proxies[current_index]
218-
current_index = (current_index + 1) % len(proxies)
219-
return proxy
220-
221-
# Use different proxy for each task
222-
for task in tasks:
223-
proxy = get_next_proxy()
224-
browser = client.browsers.create(
225-
proxy_id=proxy.id
226-
)
227-
await perform_task(browser, task)
228-
browser.close()
229-
```
230-
231-
</CodeGroup>
232-
233-
### Random rotation
234-
235-
Randomly select proxies for better distribution:
236-
237-
<CodeGroup>
238-
239-
```typescript Typescript/Javascript
240-
const proxies = await kernel.proxies.list();
241-
242-
function getRandomProxy() {
243-
const index = Math.floor(Math.random() * proxies.length);
244-
return proxies[index];
245-
}
246-
247-
const browser = await kernel.browsers.create({
248-
proxy_id: getRandomProxy().id
249-
});
250-
```
251-
252-
```Python Python
253-
import random
254-
255-
proxies = client.proxies.list()
256-
257-
def get_random_proxy():
258-
return random.choice(proxies)
259-
260-
browser = client.browsers.create(
261-
proxy_id=get_random_proxy().id
262-
)
263-
```
264-
265-
</CodeGroup>
266-
267-
## Troubleshooting
268-
269-
### Proxy connection failures
270-
271-
If a browser fails to connect through a proxy:
272-
273-
1. Verify the proxy configuration is correct
274-
2. Check if the proxy type supports your target site
275-
3. Try a different proxy type or location
276-
4. Ensure custom proxies are accessible
277-
278-
### Performance issues
279-
280-
If experiencing slow performance:
281-
282-
1. Consider using faster proxy types (ISP or datacenter)
283-
2. Choose proxy locations closer to target servers
284-
3. Reduce the number of concurrent browsers per proxy
285-
4. Monitor proxy health and rotate out slow proxies
286-
287-
## Related resources
92+
---
28893

289-
- [Proxies Overview](/proxies/overview) - Learn about proxy types and capabilities
290-
- [Stealth Mode](/browsers/stealth) - Enhance bot detection avoidance
291-
- [Browser Profiles](/browsers/profiles) - Create consistent browser identities
94+
For more information, see the [Proxies](/proxies/overview) section.

docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"browsers/standby",
6161
"browsers/persistence",
6262
"browsers/profiles",
63-
"browsers/configure-proxy",
63+
"browsers/proxies",
6464
"browsers/termination",
6565
"browsers/file-io",
6666
"browsers/live-view",

0 commit comments

Comments
 (0)