-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed robots.txt 404 error #2226
Conversation
routers/routes/routes.go
Outdated
@@ -651,7 +651,7 @@ func RegisterRoutes(m *macaron.Macaron) { | |||
if setting.HasRobotsTxt { | |||
ctx.ServeFileContent(path.Join(setting.CustomPath, "robots.txt")) | |||
} else { | |||
ctx.Error(404) | |||
ctx.Status(404) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not fixing the problem, correct code would be ctx.Handle(404, "", nil)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure? As I looked at other locations in the code where it returns a working 404.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried your code and it still returned empty 404 page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, changed it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx.Status(404)
is used only in API routes
LGTM |
LGTM |
Fixed: #2210