You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
httpcaddyfile: no warning on duplicate named routes #7798
I noticed that there were no warnings on duplicate named_routes in the Caddyfile. A warning would have made this configuration mistake much easier to spot.
The second named route definition silently replaces the first one. ( Last Write Wins ).
The adapted JSON contains only the last definition, indicating that the original route has been overwritten during adaptation.
I took a look at this and noticed that extractNamedRoutes appears to be a reasonable place to log the warning, since duplicate named routes are detected there. If this approach sounds good, I'd be happy to open a PR on this.
Well like you pointed out it clobbers the first route, so I think making it an error is a much stronger signal of a problem. A lot of people ignore warnings unfortunately.
Activity
vijayvenkatj commentedon Jun 4, 2026
I took a look at this and noticed that extractNamedRoutes appears to be a reasonable place to log the warning, since duplicate named routes are detected there. If this approach sounds good, I'd be happy to open a PR on this.
francislavoie commentedon Jun 4, 2026
Yeah sounds reasonable to make it an error to redefine a named route.
vijayvenkatj commentedon Jun 4, 2026
Should'nt It be a warning since It doesn't do any harm?
francislavoie commentedon Jun 4, 2026
Well like you pointed out it clobbers the first route, so I think making it an error is a much stronger signal of a problem. A lot of people ignore warnings unfortunately.
vijayvenkatj commentedon Jun 4, 2026
Makes sense, I would like to work on this.
httpcaddyfile: error on duplicate named_routes (#7800)