Nota: Este artigo foi publicado originalmente em 2008 and has been updated with current information. Some steps or software versions referenced may have changed. Consulte a documentação atual de documentation for the latest details.
When attempting to upload a file through a web application in Google Chrome, you may encounter the error message “Error 2 (net::ERR_FAILED): Unknown error”. In Internet Explorer, the same underlying problem often manifests as “Internet Explorer cannot display the webpage”. This error is frustratingly vague because Chrome uses net::ERR_FAILED as a catch-all for a wide range of network-level failures. This guide walks through every common cause and provides targeted fixes for each scenario.
Understanding the net::ERR_FAILED Error
The net::ERR_FAILED error code is part of Chromium’s internal network error system. Unlike more specific errors such as net::ERR_CONNECTION_REFUSED or net::ERR_SSL_PROTOCOL_ERROR, the ERR_FAILED code indicates a generic failure that does not fit into a more specific category. During file uploads, this typically means the HTTP POST request was interrupted, rejected, or timed out before the server could send a proper response.
How to Read Chrome’s Net Internals
Before diving into fixes, you can gather more diagnostic information using Chrome’s built-in network logging:
- Open a new tab and navigate to
chrome://net-export/ - Click Start Logging to Disk and choose a file location
- Reproduce the upload error in another tab
- Return to the net-export tab and click Stop Logging
- Open the log file at NetLog Viewer to analyze the detailed request lifecycle
You can also use the Network tab in Chrome DevTools (F12) to inspect the failed request. Look at the Headers, Timing, and Response tabs for clues about where the request failed.
Cause 1: Server-Side File Size Limits
The most common cause of upload failures is exceeding the maximum file size allowed by the web server or application framework.
IIS (Internet Information Services)
IIS has multiple layers of size restrictions:
web.config settings:
<configuration>
<system.web>
<!-- maxRequestLength is in kilobytes (default: 4096 KB = 4 MB) -->
<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<!-- maxAllowedContentLength is in bytes (default: 30000000 = ~28.6 MB) -->
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
Both maxRequestLength and maxAllowedContentLength must be increased. If only one is changed, the lower limit still applies. The executionTimeout value (in seconds) should also be increased for large file uploads.
IIS Manager approach:
- Open IIS Manager
- Select the site or application
- Double-click Request Filtering
- In the Actions pane, click Edit Feature Settings
- Set Maximum allowed content length to the desired value in bytes
Apache
Apache uses the LimitRequestBody directive:
# In httpd.conf or .htaccess
# Value is in bytes (0 = unlimited, default is 0 but distros often set limits)
LimitRequestBody 1073741824
If you are using mod_php, PHP has its own limits:
; php.ini settings
upload_max_filesize = 1024M
post_max_size = 1024M
max_execution_time = 3600
max_input_time = 3600
memory_limit = 2048M
All four values must be adjusted. post_max_size must be equal to or larger than upload_max_filesize.
Nginx
Nginx uses the client_max_body_size directive:
# In nginx.conf, within http, server, or location block
client_max_body_size 1024m;
# Also increase timeouts for large uploads
client_body_timeout 3600s;
proxy_read_timeout 3600s;
proxy_connect_timeout 3600s;
proxy_send_timeout 3600s;
After making changes, reload the Nginx configuration:
sudo nginx -t && sudo systemctl reload nginx
Cause 2: CORS (Cross-Origin Resource Sharing) Misconfiguration
If the upload endpoint is on a different domain, subdomain, or port than the page initiating the upload, CORS policies apply. A missing or misconfigured CORS response will cause Chrome to block the request and report net::ERR_FAILED.
Diagnosing CORS Issues
In Chrome DevTools, look for messages like:
Access to XMLHttpRequest at 'https://api.example.com/upload'
from origin 'https://www.example.com' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Fixing CORS on the Server
For IIS (web.config):
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="https://www.example.com" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Content-Type, Authorization" />
<add name="Access-Control-Max-Age" value="86400" />
</customHeaders>
</httpProtocol>
</system.webServer>
For Apache (.htaccess or httpd.conf):
Header set Access-Control-Allow-Origin "https://www.example.com"
Header set Access-Control-Allow-Methods "GET, POST, PUT, OPTIONS"
Header set Access-Control-Allow-Headers "Content-Type, Authorization"
Header set Access-Control-Max-Age "86400"
For Nginx:
location /upload {
if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Origin "https://www.example.com";
add_header Access-Control-Allow-Methods "GET, POST, PUT, OPTIONS";
add_header Access-Control-Allow-Headers "Content-Type, Authorization";
add_header Access-Control-Max-Age 86400;
return 204;
}
add_header Access-Control-Allow-Origin "https://www.example.com";
}
Avoid using * (wildcard) for Access-Control-Allow-Origin when the request includes credentials, as browsers will reject this combination.
Cause 3: Request Timeout
Large file uploads over slow connections can exceed the server’s or the browser’s timeout thresholds. The upload may appear to progress and then suddenly fail.
Server-Side Timeouts
Increase timeouts on the server as shown in the file size sections above. Additionally:
- IIS: Set the connection timeout in IIS Manager under the site’s Advanced Settings > Connection Limits > Connection Time-out
- Apache: Adjust
Timeoutdirective (default 300 seconds) - Nginx: Adjust
client_body_timeout,proxy_read_timeout, andsend_timeout
Proxy and Load Balancer Timeouts
If there is a reverse proxy or load balancer (such as AWS ALB, Cloudflare, or HAProxy) between the client and the server, that layer often has its own timeout settings. For example, AWS Application Load Balancer has a default idle timeout of 60 seconds.
Cause 4: Browser Cache and Corrupted State
A corrupted browser cache or conflicting cached data can cause upload failures.
Passos to Clear Browser State
- Open Chrome Settings > Privacy and security > Clear browsing data
- Select All time for the time range
- Check Cached images and files and Cookies and other site data
- Click Clear data
- Restart Chrome and retry the upload
Alternatively, test in an Incognito window (Ctrl+Shift+N) to bypass cache and extensions.
Cause 5: Browser Extensions and Segurança Software
Ad blockers, privacy extensions, VPNs, and desktop antivirus software can all interfere with file uploads by modifying headers, blocking requests, or scanning upload payloads.
Diagnosis Passos
- Open Chrome in Incognito mode (or a Guest profile)
- Try the upload again
- If it works, the issue is caused by an extension or local security software
- Disable extensions one by one to identify the culprit
- Check antivirus or firewall logs for blocked requests
Cause 6: SSL/TLS Certificate Issues
If the upload endpoint uses HTTPS with an expired, self-signed, or misconfigured SSL certificate, Chrome may silently fail the request.
Passos to Diagnose
- Navigate directly to the upload URL in Chrome
- Check if Chrome shows a certificate warning
- Use an SSL checker tool like SSL Labs to verify the certificate chain
- Ensure intermediate certificates are properly installed on the server
Cause 7: Web Application Firewall (WAF) Rules
WAFs such as ModSegurança, Cloudflare WAF, or AWS WAF may block file uploads based on content type, file content patterns, or request size.
Diagnosis
- Check WAF logs for blocked requests
- Temporarily disable WAF rules for the upload endpoint to test
- Whitelist the upload endpoint or specific content types in the WAF configuration
Solução de Problemas Checklist
| Passo | Action | Tool |
|---|---|---|
| 1 | Check Chrome DevTools Network tab for status codes | F12 > Network |
| 2 | Look for CORS errors in the Console tab | F12 > Console |
| 3 | Test with a small file (under 1 MB) | Browser |
| 4 | Test in Incognito mode | Ctrl+Shift+N |
| 5 | Check server error logs | Server CLI or hosting panel |
| 6 | Verify server file size limits | Server configuration files |
| 7 | Test from a different network | Different Wi-Fi or mobile data |
| 8 | Capture net-export logs | chrome://net-export/ |
Resumo
The net::ERR_FAILED error during file uploads is a generic Chrome network error with multiple possible root causes. Start by checking the Network tab in DevTools for more specific error details, then work through file size limits, CORS configuration, timeout settings, and browser state in that order. Most cases are resolved by adjusting server-side upload limits or fixing CORS headers. If the problem persists after exhausting these steps, capture detailed logs using chrome://net-export/ and review server-side error logs for additional diagnostic information.