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

zrhoffman pushed a commit to branch 6.0.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 505bf09de234dd39fbb83474b16d9fc3e816c467
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)
    
    (cherry picked from commit c6c452a29d4048efc5669fb270edbc4126f91d22)
---
 CHANGELOG.md                       | 1 +
 traffic_monitor/srvhttp/srvhttp.go | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9744718..ed62ce2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -103,6 +103,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