Bug 1106 - Return Custom Page With Status Code 200 by checking the respective HTTP Methods|AS-15362|ONGC
Review Request #549 — Created Nov. 27, 2024 and submitted
| Information | |
|---|---|
| weikai | |
| APV10 | |
| rel_apv_10_7_2_5_irule | |
| 1106 | |
| Reviewers | |
| kevin.poh, tanya, timlai | |
Modify the 'http::method' function in ePolicy to parse common HTTP methods defined in RFC 9110, including GET, POST, PUT, DELETE, HEAD, CONNECT, OPTIONS, TRACE, and TRACK in IIS.
Write an example ePolicy script and test it using a curl command.
curl <URL>
curl -i -X TRACE <URL>
curl -i -X TRACK <URL>#description:TRACE_TRACK_sample.tcl when HTTP_REQUEST_HEADER { set http_method [http::method] log $http_method if { $http_method == "TRACE" } { http::respond "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nContent-Length: 185\r\n\r\n<html>\r\n<head>\r\n<title>APV HTTP Method</title>\r\n</head>\r\n<body>\r\n<h1>APV: GET HTTP Method TRACE</h1>\r\n<p>This is an HTTP response demonstrating the TRACE method.</p>\r\n</body>\r\n</html>\r\n" } elseif { $http_method == "TRACK" } { http::respond "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nContent-Length: 185\r\n\r\n<html>\r\n<head>\r\n<title>APV HTTP Method</title>\r\n</head>\r\n<body>\r\n<h1>APV: GET HTTP Method TRACK</h1>\r\n<p>This is an HTTP response demonstrating the TRACK method.</p>\r\n</body>\r\n</html>\r\n" } else { # Other method: Bypass to the default policy. # Or other handling procedures } }
Testing Done: |
|
|---|
