I had problems uploading files to wordpress hosted at the local machine. Conditions are:
- Firefox 3.0
- Flash 9.0
- Local squid proxy 2.7.STABLE3
- Firefox setup for using local proxy except from accessing local machine. This makes no difference at all.
- Environment variable http_proxy set to http://127.0.0.1:8080/
The result of trying to upload images to wordpress was “HTTP Error”. A sample wireshark capture of the failed request looks like this:
POST http://localhost/wordpress/wp-admin/async-upload.php HTTP/1.1 Host: localhost Pragma: no-cache Accept: */* Proxy-Connection: Keep-Alive User-Agent: Shockwave Flash Connection: Keep-Alive Cache-Control: no-cache Content-Length: 40861 Expect: 100-continue Content-Type: multipart/form-data; boundary=----------------------------5ce16f6dfa7a
HTTP/1.0 417 Expectation failed Server: squid/2.7.STABLE3 Date: Sun, 27 Jul 2008 09:31:50 GMT Content-Type: text/html Content-Length: 1507 Expires: Sun, 27 Jul 2008 09:31:50 GMT X-Squid-Error: ERR_INVALID_REQ 0 X-Cache: MISS from XXXXX.XXXX.XXXX X-Cache-Lookup: NONE from XXXXX.XXXX.XXXX:3128 Via: 1.0 XXXXX.XXXX.XXXX:3128 (squid/2.7.STABLE3) Connection: close [...] A page saying: ERROR: The requested URL could not be retrieved [...]
It is obvious that flash plugin is used to perform the upload and it is using the proxy. It does a request with an “Expect:” header and for an (unknown to me) reason the expectation fails because of the squid proxy.
Disabling proxy in firefox, restarting it and bypassing cache doesn’t help. The problem lies in that the flash plugin uses the http_proxy environment variable to determine the proxy.
Unsetting http_proxy in a terminal and starting firefox from there solves the problem.