This is an automated email from the ASF dual-hosted git repository.

ocket8888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new c6c452a  Updated Traffic Monitor to return a 404 if the endpoint is 
not supported (#6192)
c6c452a is described below

commit c6c452a29d4048efc5669fb270edbc4126f91d22
Author: mattjackson220 <[email protected]>
AuthorDate: Fri Sep 10 13:44:17 2021 -0600

    Updated Traffic Monitor to return a 404 if the endpoint is not supported 
(#6192)
---
 CHANGELOG.md                       | 1 +
 traffic_monitor/srvhttp/srvhttp.go | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2a37b5a..31be559 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -111,6 +111,7 @@ The format is based on [Keep a 
Changelog](http://keepachangelog.com/en/1.0.0/).
 - [#6169](https://github.com/apache/trafficcontrol/issues/6169) - Fixed 
t3c-update not updating server status when a fallback to a previous Traffic Ops 
API version occurred
 - [#5576](https://github.com/apache/trafficcontrol/issues/5576) - Inconsistent 
Profile Name restrictions
 - Fixed Federations IMS so TR federations watcher will get updates.
+- [#5129](https://github.com/apache/trafficcontrol/issues/5129) - Updated TM 
so that it returns a 404 if the endpoint is not supported.
 
 ### Changed
 - Migrated completely off of bower in favor of npm
diff --git a/traffic_monitor/srvhttp/srvhttp.go 
b/traffic_monitor/srvhttp/srvhttp.go
index 5720c9e..3cb2ca3 100644
--- a/traffic_monitor/srvhttp/srvhttp.go
+++ b/traffic_monitor/srvhttp/srvhttp.go
@@ -259,6 +259,11 @@ func (s *Server) handleFile(name string) 
(http.HandlerFunc, error) {
        }
        contentType := http.DetectContentType(bytes)
        return func(w http.ResponseWriter, req *http.Request) {
+               if req.URL.Path != "/" {
+                       http.NotFound(w, req)
+                       return
+               }
+
                w.Header().Set(rfc.ContentType, contentType)
                w.Header().Set(rfc.PermissionsPolicy, "interest-cohort=()")
                fmt.Fprintf(w, "%s", bytes)

Reply via email to