Skip to main content

PUT Method enabled?

Comments

19 comments

  • vs-fam
    Ok, netcat found out PUT is not enabled. How can PUT be enabled? Thanks
    0
  • vs-fam
    Ok, solved it by using an include file, following these:
    -1
  • cPanelPeter cPanel Staff
    Hello, Glad you figured it out and thank you for posting your solution.
    0
  • vs-fam
    Unfortunately spoke too soon. After I ran into mod security blocks I'm stuck again. Now I get "501 Not implemented" and GET to the folder not supported. Any ideas? I'll keep digging
    0
  • cPanelMichael
    Hello, Could you elaborate on the Mod_Security issues? What error messages do you see in /usr/local/apache/logs/error_log when this happens? Thank you.
    0
  • vs-fam
    Thanks Michael and Peter for following this thread. It's finally solved. It was still mod security issues and a bit of .htaccess rules to forward the request accordingly. 2 mod security rules were blocking the requests: ID 1234123435 ID 1234123429 Disable them or modify them. I disabled them. To sum up for future reference: This is the include file for the vhost to enable PUt method:
    Order allow,deny Allow from all
    This is the .htaccess content (with basic auth):
    AuthType Basic AuthName "Your title" AuthUserFile "/path/to/passwd" require valid-user RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.+$ - [NC,L] RewriteCond %{REQUEST_METHOD} (PUT|DELETE) RewriteRule .* put.php
    This is the put.php file that will handle the PUT request: [PHP]$putdata = fopen("php://input", "r"); $file="your_filename.txt"; $fp = fopen($file, "w"); while ($data = fread($putdata, 1024)){ fwrite($fp, $data); } fclose($fp); fclose($putdata);[/PHP] Everything has to be in the same folder or update your paths accordingly.
    0
  • cPanelMichael
    I am happy to see the issue is now resolved. Thank you.
    0
  • ramorse
    I have client that has requested this. I have tried implementing by following documentation and creating a user defined .conf file. Haven't tried the .htaccess yet as I am not sure what part it plays. But it so far hasn't worked.
    0
  • ramorse
    Also, I am not getting any mod_security hits on that domain when the client tries this.
    0
  • cPanelMichael
    I have client that has requested this. I have tried implementing by following documentation and creating a user defined .conf file. Haven't tried the .htaccess yet as I am not sure what part it plays. But it so far hasn't worked.

    Hello :) You mentioned following the documentation and creating a user defined .conf file. Could you let us know which specific steps you have taken so we can determine if you made any mistakes? Thank you.
    0
  • ramorse
    Sure. I followed the steps at Modify Virtualhost Containers With Include Files - EasyApache - cPanel Documentation in that, as I am running Apache 2.2 and this is a non SSL account I went to /usr/local/apache/conf/userdata/std/2_2/ I created a userdirectory as one for that user didn't exist. Then in that directory I created directory for the domain (ie user.com). In that directory I created a file called allowput.conf. In that file I put: Order allow,deny Allow from all Then I restarted Apached. Now one complication may be that I am using Cloud Linux. But just in case that would cause some change like this to not work I ran cagefsctl --force-update.
    0
  • cPanelMichael
    Haven't tried the .htaccess yet as I am not sure what part it plays.

    This is what forwards the PUT request. You must follow the step that suggests editing the .htaccess and creating the put.php file if you want to take the same action as the original poster. Note the Authorization entries in the example .htaccess file provided by the original poster are only required if you are password protecting the directory. Thank you.
    0
  • ramorse
    OK I created the put.php file and chownd to the user. Although I did put *.ics for the $filename. And we have the .htaccess in there withouth the password lines. Still getting a 500 error.
    0
  • cPanelMichael
    OK I created the put.php file and chownd to the user. Although I did put *.ics for the $filename. And we have the .htaccess in there withouth the password lines. Still getting a 500 error.

    What's the specific error output to /usr/local/apache/logs/error_log when this happens? Have you tried entering one specific filename instead of a wildcard to see if you get the same result? Thank you.
    0
  • ramorse
    There is nothing related to this in /usr/local/apache/logs/error_log. I changed it back to the specific file name in put.php and asked him to try again. He got the same result. I checked the error_log again. Nothing for the domain for today. I asked him for a screen shot of what happens when he tries this and the erro mesage is from his desktop Calendar app. So, it may not be getting written to the logfile.
    0
  • cPanelMichael
    I asked him for a screen shot of what happens when he tries this and the erro mesage is from his desktop Calendar app. So, it may not be getting written to the logfile.

    What's the specific error message in their application? Thank you.
    0
  • ramorse
    At one point the screen shot said: "path to location" is not a location that supports this request. Later after adding the .htaccess and put.php with the specific file he was trying to put (a .ics file) it just said "failed. The server responded with "500".
    0
  • cPanelMichael
    We won't be able to troubleshoot your custom script, but you can open a support ticket using the link in my signature so we can review your Apache logs to determine if there's any output related to that connection attempt. Post the ticket number here and we can update this thread with the outcome. Thank you.
    0
  • ramorse
    I have submitted the support request. ID: 7511253 Thanks.
    0

Please sign in to leave a comment.