Repository navigation
|
My index route looks a like this: public static void index ()
{
Exchange exchange = renderArgs.get("exchange", Exchange.class);
if ("open".equals(exchange.status))
{
List<Country> countries = Country.find("order by name").fetch();
render(countries);
}
else if (!"closed".equals(exchange.status))
{
renderTemplate("Application/processing.html");
}
renderTemplate("Application/closed.html");
}and it's been working fine up through 1.9.x, but I very recently upgraded it to 1.11.0 after doing the javax -> jakarta bit, and so on. I changed some other things, but not this endpoint. However, it seems once after start-up in prod mode I get a log entry like this:
The first time I saw it, it tried "Application/index.txt", but regardless, there's only a ".html" file for that endpoint. The 500 did not seem to surface to the front-end, as everything rendered normally as far as I could tell, but I also didn't have the dev tools open. I don't know what triggers it, since it doesn't seem to happen reliably. Even if it is trying to dynamically determine what's available, in case I had picked something other than HTML and expected it to work, I would've thought it would check what's available before trying it. Is this harmless? or is it gonna fill my logs once I get more people hopping on to register? I don't know. I suppose I can fix it by switching to |
Replies: 1 comment 1 reply
|
This isn't new in 1.11. Controller.java and Http.java are identical between 1.9.0 and 1.11.0, so the upgrade didn't change it. More likely a client with a different Accept header started hitting the new deploy.
I reproduced it in Docker with the 1.9.0 and 1.11.0 release zips ( Browsers send text/html, so real users are fine. The 500s most likely come from a bot, uptime checker or link preview fetcher. Your That returned 200 for JSON and plain Accept headers in my test too. Note that Can you tell from your access logs which user agent is behind those requests? |
This isn't new in 1.11. Controller.java and Http.java are identical between 1.9.0 and 1.11.0, so the upgrade didn't change it. More likely a client with a different Accept header started hitting the new deploy.
render()with no template name usesaction + "." + request.format, andHttp.Request.resolveFormat()sets the format from the Accept header. If the header containstext/htmlorapplication/xhtml, or starts with*/*, you gethtml. Otherwiseapplication/xmlortext/xmlgivesxml,text/plaingivestxt, andapplication/jsonortext/javascriptgivesjson. There's no fallback to .html when that file is missing.I reproduced it in Docker with the 1.9.0 and 1.11.0 release zips (
play new, a …