<-
Apache > HTTP Server > Documentation > Modules

Apache Module mod_proxy_ftp 1k6ya

Available Languages:  fr 

Description: FTP module for mod_proxy
Status: Extension
Module Identifier: proxy_ftp_module
Source File: mod_proxy_ftp.c

Summary 6m2os

This module requires the service of mod_proxy. It provides for the proxying FTP sites. Note that FTP is currently limited to the GET method.

Thus, in order to get the ability of handling FTP proxy requests, mod_proxy_ftp have to be present in the server.

Warning 6h505h

Do not enable proxying until you have secured your server. Open proxy servers are dangerous both to your network and to the Internet at large.

 Apache!

Topics 2c136y

Directives 1a4l6m

Bugfix checklist 4i2533

See also 27136x

top

Why doesn't file type xxx via FTP? 1d1q4a

You probably don't have that particular file type defined as application/octet-stream in your proxy's mime.types configuration file. A useful line can be:

application/octet-stream   bin dms lha lzh exe class tgz taz

Alternatively you may prefer to use the ForceType directive to default everything to binary:

ForceType application/octet-stream
top

How can I force an FTP ASCII of file xxx? z414q

In the rare situation where you must a specific file using the FTP ASCII transfer method (while the default transfer is in binary mode), you can override mod_proxy's default by suffixing the request with ;type=a to force an ASCII transfer. (FTP Directory listings are always executed in ASCII mode, however.)

top

How can I do FTP ? 4p2k51

Currently, only GET is ed for FTP in mod_proxy. You can of course use HTTP (POST or PUT) through an Apache proxy.

top

How can I access FTP files outside of my home directory? 6w1fd

An FTP URI is interpreted relative to the home directory of the who is logging in. Alas, to reach higher directory levels you cannot use /../, as the dots are interpreted by the browser and not actually sent to the FTP server. To address this problem, the so called Squid %2f hack was implemented in the Apache FTP proxy; it is a solution which is also used by other popular proxy servers like the Squid Proxy Cache. By prepending /%2f to the path of your request, you can make such a proxy change the FTP starting directory to / (instead of the home directory). For example, to retrieve the file /etc/motd, you would use the URL:

ftp://@host/%2f/etc/motd

top

How can I hide the FTP cleartext in my browser's URL line? 26wz

To to an FTP server by name and , Apache uses different strategies. In absence of a name and in the URL altogether, Apache sends an anonymous to the FTP server, i.e.,

: anonymous
: apache-proxy@

This works for all popular FTP servers which are configured for anonymous access.

For a personal with a specific name, you can embed the name into the URL, like in:

ftp://name@host/myfile

If the FTP server asks for a when given this name (which it should), then Apache will reply with a 401 (Authorization required) response, which causes the Browser to pop up the name/ dialog. Upon entering the , the connection attempt is retried, and if successful, the requested resource is presented. The advantage of this procedure is that your browser does not display the in cleartext (which it would if you had used

ftp://name:@host/myfile

in the first place).

Note 196q6v

The which is transmitted in such a way is not encrypted on its way. It travels between your browser and the Apache proxy server in a base64-encoded cleartext string, and between the Apache proxy and the FTP server as plaintext. You should therefore think twice before accessing your FTP server via HTTP (or before accessing your personal files via FTP at all!) When using insecure channels, an eavesdropper might intercept your on its way.

top

Why do I get a file listing when I expected a file to be ed? h6f5p

In order to allow both browsing the directories on an FTP server and ing files, Apache looks at the request URL. If it looks like a directory, or contains wildcard characters ("*?[{~"), then it guesses that a listing is wanted instead of a .

You can disable the special handling of names with wildcard characters. See the ProxyFtpListOnWildcard directive.

top

ProxyFtpDirCharset Directive 2g2566

Description: Define the character set for proxied FTP listings
Syntax: ProxyFtpDirCharset character_set
Default: ProxyFtpDirCharset ISO-8859-1
Context: server config, virtual host, directory
Status: Extension
Module: mod_proxy_ftp
Compatibility: Available in Apache 2.2.7 and later. Moved from mod_proxy in Apache 2.3.5.

The ProxyFtpDirCharset directive defines the character set to be set for FTP directory listings in HTML generated by mod_proxy_ftp.

top

ProxyFtpEscapeWildcards Directive 2x376e

Description: Whether wildcards in requested filenames are escaped when sent to the FTP server
Syntax: ProxyFtpEscapeWildcards on|off
Default: ProxyFtpEscapeWildcards on
Context: server config, virtual host, directory
Status: Extension
Module: mod_proxy_ftp
Compatibility: Available in Apache 2.3.3 and later

The ProxyFtpEscapeWildcards directive controls whether wildcard characters ("*?[{~") in requested filenames are escaped with backslash before sending them to the FTP server. That is the default behavior, but many FTP servers don't know about the escaping and try to serve the literal filenames they were sent, including the backslashes in the names.

Set to "off" to allow ing files with wildcards in their names from FTP servers that don't understand wildcard escaping.

top

ProxyFtpListOnWildcard Directive 4h1dz

Description: Whether wildcards in requested filenames trigger a file listing
Syntax: ProxyFtpListOnWildcard on|off
Default: ProxyFtpListOnWildcard on
Context: server config, virtual host, directory
Status: Extension
Module: mod_proxy_ftp
Compatibility: Available in Apache 2.3.3 and later

The ProxyFtpListOnWildcard directive controls whether wildcard characters ("*?[{~") in requested filenames cause mod_proxy_ftp to return a listing of files instead of ing a file. By default (value on), they do.

Set to "off" to allow ing files even if they have wildcard characters in their names.

Available Languages:  fr 

top

Comments 2p1l6j

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed by our s if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to our mailing lists.