HTTP
305 - Use Proxy
Seeing a 305 Use Proxy means the server wants you to access the resource through a proxy specified in the Location header—this status code is deprecated and rarely used in modern web development. This client-side redirect (3xx) was meant for proxy configuration but is obsolete. Most common in legacy systems, but modern applications should use 307 or 308 redirects instead, or configure proxies directly without this status code.
#Common Causes
- →Frontend: Legacy system returns 305. Deprecated proxy configuration. Old API uses 305.
- →Backend: Legacy server returns 305. Deprecated redirect method. Old proxy configuration.
- →Infrastructure: Legacy proxy configuration. Old reverse proxy setup.
✓Solutions
- 1Step 1: Diagnose - Check DevTools Network tab Location header—305 responses show proxy URL. Review if proxy is actually needed. Check if this is legacy behavior.
- 2Step 2: Diagnose - Server logs show 305 configuration. Review proxy setup. Check if this is intentional. Verify proxy URL.
- 3Step 3: Fix - Client-side: Use proxy from Location header if needed. Configure proxy directly. Update to modern redirect handling. Use 307/308 instead.
- 4Step 4: Fix - Server-side: Replace 305 with 307 or 308. Configure proxy directly. Update to modern redirect methods. Remove deprecated status code.
- 5Step 5: Fix - Infrastructure: Update proxy configuration. Replace 305 with modern redirects. Configure proxies directly.
</>Code Examples
Fetch API: Handle 305 Use Proxy (Deprecated)
1// Client-side: Handle deprecated 305 status code
2async function fetchWithProxy(url) {
3 const response = await fetch(url, { redirect: 'manual' });
4
5 if (response.status === 305) {
6 const proxyUrl = response.headers.get('Location');
7 console.warn('305 Use Proxy is deprecated - use 307 or 308 instead');
8 console.log('Proxy URL:', proxyUrl);
9
10 // Use proxy for request
11 // Note: Modern browsers may handle this automatically
12 // Better to configure proxy directly or use 307/308
13 return fetch(proxyUrl);
14 }
15
16 return response.json();
17}
18
19// Modern alternative: Configure proxy directly
20async function fetchWithDirectProxy(url, proxyUrl) {
21 // Configure proxy directly instead of using 305
22 const proxyConfig = {
23 host: new URL(proxyUrl).hostname,
24 port: new URL(proxyUrl).port || 80,
25 };
26
27 // Use proxy for request (implementation depends on environment)
28 // In Node.js, use http-proxy-agent
29 // In browser, configure proxy at network level
30 return fetch(url);
31}
32
33// Recommended: Use 307/308 redirects instead
34async function fetchWithModernRedirect(url) {
35 const response = await fetch(url, { redirect: 'manual' });
36
37 // Modern servers should use 307 or 308 instead of 305
38 if (response.status === 307 || response.status === 308) {
39 const newUrl = response.headers.get('Location');
40 return fetch(newUrl);
41 }
42
43 return response.json();
44}Express.js: Replace 305 with Modern Redirects
1// Server-side: Replace deprecated 305 with modern redirects
2const express = require('express');
3const app = express();
4
5// DON'T use 305 - it's deprecated
6// BAD:
7app.get('/api/legacy', (req, res) => {
8 res.status(305)
9 .set('Location', 'http://proxy.example.com/api/legacy')
10 .end();
11});
12
13// GOOD: Use 307 or 308 instead
14app.get('/api/resource', (req, res) => {
15 // Temporary redirect with method preservation
16 res.redirect(307, 'http://proxy.example.com/api/resource');
17});
18
19// Or configure proxy directly
20const httpProxy = require('http-proxy-middleware');
21
22app.use('/api/proxied', httpProxy({
23 target: 'http://proxy.example.com',
24 changeOrigin: true,
25 // No need for 305 status code
26}));
27
28// Modern approach: Configure proxy at infrastructure level
29// Don't use 305 status code in modern applicationsNginx: Replace 305 with Modern Redirects
1# Nginx: Don't use deprecated 305 - use 307/308 instead
2server {
3 listen 80;
4 server_name api.example.com;
5
6 # DON'T use 305 - it's deprecated
7 # BAD:
8 # location /api/legacy {
9 # return 305 http://proxy.example.com/api/legacy;
10 # }
11
12 # GOOD: Use 307 or 308 instead
13 location /api/resource {
14 return 307 http://proxy.example.com/api/resource$is_args$args;
15 }
16
17 # Or configure proxy directly
18 location /api/proxied/ {
19 proxy_pass http://proxy.example.com/;
20 proxy_set_header Host $host;
21 proxy_set_header X-Real-IP $remote_addr;
22 # No need for 305 status code
23 }
24
25 # Modern approach: Configure proxy at load balancer level
26 # Don't use 305 status code in modern configurations↗Related Errors
Provider Information
This error code is specific to HTTP services. For more information, refer to the official HTTP documentation.