The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PUT Method enabled?

Discussion in 'General Discussion' started by vs-fam, May 8, 2015.

  1. vs-fam

    vs-fam Active Member

    Joined:
    Mar 18, 2010
    Messages:
    30
    Likes Received:
    1
    Trophy Points:
    8
    Hi,

    I'm trying to find out if PUT method is enabled (most likely not, but just to be sure). Can't get netcat to find out, I get no output.

    However, is it possible to enable it? I did some search but no luck.

    Thanks
     
  2. vs-fam

    vs-fam Active Member

    Joined:
    Mar 18, 2010
    Messages:
    30
    Likes Received:
    1
    Trophy Points:
    8
    Ok, netcat found out PUT is not enabled. How can PUT be enabled?

    Thanks
     
  3. vs-fam

    vs-fam Active Member

    Joined:
    Mar 18, 2010
    Messages:
    30
    Likes Received:
    1
    Trophy Points:
    8
  4. cPanelPeter

    cPanelPeter Technical Analyst III
    Staff Member

    Joined:
    Sep 23, 2013
    Messages:
    569
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Glad you figured it out and thank you for posting your solution.
     
  5. vs-fam

    vs-fam Active Member

    Joined:
    Mar 18, 2010
    Messages:
    30
    Likes Received:
    1
    Trophy Points:
    8
    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
     
    #5 vs-fam, May 13, 2015
    Last edited: May 13, 2015
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    649
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  7. vs-fam

    vs-fam Active Member

    Joined:
    Mar 18, 2010
    Messages:
    30
    Likes Received:
    1
    Trophy Points:
    8
    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:
    Code:
    <Directory /path/to/specific/folder/to/handle/put/requests>
       <Limit PUT GET POST DELETE HEAD OPTIONS>
           Order allow,deny
           Allow from all
       </Limit>
    </Directory>
    This is the .htaccess content (with basic auth):
    Code:
    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($putdata1024)){
        
    fwrite($fp$data);
    }

    fclose($fp);
    fclose($putdata);
    Everything has to be in the same folder or update your paths accordingly.
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    649
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  9. ramorse

    ramorse Well-Known Member

    Joined:
    Sep 6, 2003
    Messages:
    201
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    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.
     
  10. ramorse

    ramorse Well-Known Member

    Joined:
    Sep 6, 2003
    Messages:
    201
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Also, I am not getting any mod_security hits on that domain when the client tries this.
     
  11. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    649
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  12. ramorse

    ramorse Well-Known Member

    Joined:
    Sep 6, 2003
    Messages:
    201
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    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:

    <Directory /home/theusername/public_html/testcalendar>
    <Limit PUT GET POST DELETE HEAD OPTIONS>
    Order allow,deny
    Allow from all
    </Limit>
    </Directory>
    </Directory>

    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.
     
  13. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    649
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  14. ramorse

    ramorse Well-Known Member

    Joined:
    Sep 6, 2003
    Messages:
    201
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    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.
     
  15. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    649
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  16. ramorse

    ramorse Well-Known Member

    Joined:
    Sep 6, 2003
    Messages:
    201
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    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.
     
  17. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    649
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    What's the specific error message in their application?

    Thank you.
     
  18. ramorse

    ramorse Well-Known Member

    Joined:
    Sep 6, 2003
    Messages:
    201
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    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".
     
  19. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    649
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  20. ramorse

    ramorse Well-Known Member

    Joined:
    Sep 6, 2003
    Messages:
    201
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    I have submitted the support request. ID: 7511253

    Thanks.
     
Loading...

Share This Page