| Author |
|
oliv2831
Joined: 16 Mar 2026 Posts: 4
|
Posted: Mon 16 Mar '26 19:57 Post subject: method PUT is not allowed for this URL |
|
|
Hello,
My goal is to configure an 2.4.66 Apache instance on Debian 13 to accept file uploads from local IP phones using PUT method.
I've tested many combinations of the following config:
| Code: | <VirtualHost *:80>
ServerAdmin jdoe@example.com
Alias / /srv/tftp/
DocumentRoot /srv/tftp/
LogLevel debug
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/srv/tftp/">
Options Indexes FollowSymLinks
AllowOverride None
<Limit GET POST OPTIONS PUT DELETE>
Require all granted
</Limit>
</Directory>
<Location "/yealink/uploads/toto.txt">
AllowMethods GET POST OPTIONS PUT DELETE
Script PUT /cgi-bin/file_upload.php
</Location>
</VirtualHost> |
I'm testing with :
curl --verbose -T /tmp/toto.txt http://192.168.4.5/yealink/uploads/toto.txt
...
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method PUT is not allowed for this URL.</p>
Error.log shows:
| Code: | [Mon Mar 16 18:40:58.257519 2026] [authz_core:debug] [pid 66299:tid 66306] mod_authz_core.c(815): [client 192.168.4.187:56986] AH01626: authorization result of Require all granted: granted
[Mon Mar 16 18:40:58.257768 2026] [authz_core:debug] [pid 66299:tid 66306] mod_authz_core.c(815): [client 192.168.4.187:56986] AH01626: authorization result of <RequireAny>: granted
[Mon Mar 16 18:40:58.257880 2026] [authz_core:debug] [pid 66299:tid 66306] mod_authz_core.c(815): [client 192.168.4.187:56986] AH01626: authorization result of Require all granted: granted
[Mon Mar 16 18:40:58.257888 2026] [authz_core:debug] [pid 66299:tid 66306] mod_authz_core.c(815): [client 192.168.4.187:56986] AH01626: authorization result of <RequireAny>: granted |
My script file /usr/lib/cgi-bin/file_upload.php is:
| Quote: | <?php
error_log("Current user is ".get_current_user());
$data = file_get_contents("php://input");
//$output_filename = $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'];
$output_filename = $_SERVER['DOCUMENT_ROOT'].$_SERVER['PATH_INFO'];
$code = file_put_contents($output_filename, $data);
if (strlen($data) !== $code)
error_log("Error code while writing ".$output_filename.": input length is ".strlen($data)." while output length is ".$code);
?> |
How can I get this working ?
Best regards |
|
| Back to top |
|
Stray78

Joined: 15 Apr 2024 Posts: 57 Location: USA
|
Posted: Mon 16 Mar '26 21:51 Post subject: |
|
|
| Do you have mod_actions enabled? |
|
| Back to top |
|
oliv2831
Joined: 16 Mar 2026 Posts: 4
|
Posted: Tue 17 Mar '26 9:54 Post subject: method PUT is not allowed for this URL |
|
|
| Yes mod_actions is enabled. |
|
| Back to top |
|
oliv2831
Joined: 16 Mar 2026 Posts: 4
|
Posted: Tue 17 Mar '26 12:11 Post subject: |
|
|
| Code: | apachectl -t -D DUMP_MODULES
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.64.250. Set the 'ServerName' directive globally to suppress this message
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
actions_module (shared)
alias_module (shared)
allowmethods_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgid_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
mime_module (shared)
mpm_event_module (shared)
negotiation_module (shared)
reqtimeout_module (shared)
setenvif_module (shared)
status_module (shared) |
|
|
| Back to top |
|
oliv2831
Joined: 16 Mar 2026 Posts: 4
|
Posted: Wed 18 Mar '26 14:38 Post subject: [SOLVED] method PUT is not allowed for this URL |
|
|
I could use PUT method after enabling Dav module.
I'm inclined to now think AllowMethods cannot add new methods such as PUT but I'm far from certain about that. |
|
| Back to top |
|