Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you find the list of all the supported HTTP methods by a webserver?

I've a apache server running on 10.0.0.3, using nc how can i get the list of supported http methods? I tried with this.. no success.

nc 10.0.0.3 80
OPTIONS /

and the response is 500 server error..

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at
 webmaster@localhost to inform them of the time this error occurred,
 and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at 127.0.1.1 Port 80</address>
</body></html>

What's the mistake in this?

like image 748
alam Avatar asked Sep 13 '25 09:09

alam


1 Answers

Try with curl using -i to show the response headers, and using -L to follow any redirects:

curl -i -L -X OPTIONS http://10.0.0.3/

You’ll see some response headers that include an Allow header; example:

Allow: OPTIONS,GET,HEAD,POST

If you really want to instead use nc, you can do it like this:

$ nc 10.0.0.3 80
OPTIONS / HTTP/1.1
Host: 10.0.0.3

What’s different about that from the nc invocation in the question is:

  • Append HTTP/1.1 to the OPTIONS line (just as you must with GET, HEAD, etc.)
  • Include a Host: <hostname> line after the OPTIONS line
like image 132
sideshowbarker Avatar answered Sep 16 '25 09:09

sideshowbarker