A small trick to avoid 404 error when redmine runs on dreamhost

简介:

I locate my redmine webite on dreamhost shared-host. It works well in the first 8 months. But recently I meet 404 Page not found frequently when I post a topic in the forum, or create new issues. This weekend I decide to dig the bug.

 

The problem looks like this in redmine/log/production.log 

 

复制代码
Processing IssuesController # create (for 999.999.999.99 at 2011-07-09 08:38:36) [POST]
  Parameters: { " commit " => " 创建 " " project_id " => " test " " action " => " create " " authenticity_token " => " JOLhksjiN1Wmpt4iAVrw22Y+9+Pvdn1Kr6RwMQ3xDac= " " issue " => { " start_date " => " 2011-07-09 " " estimated_hours " => "" " priority_id " => " 4 " " parent_issue_id " => "" " assigned_to_id " => "" " subject " => " performance test " " tracker_id " => " 1 " " due_date " => "" " status_id " => " 1 " " description " => " 12313 " },  " controller " => " issues " " attachments " => { " 1 " => { " description " => "" }}}
Sending email notification to: 
Redirected to http:
// project.cocos2d - x.com / issues / 62
Completed 
in  674ms (DB:  408 |   302  Found [http: // project.cocos2d - x.com / projects / test / issues]


Processing ApplicationController
# index (for 125.77.152.242 at 2011-07-09 08:38:37) [GET]

ActionController::RoutingError (No route matches 
" /internal_error.html "  with {:method => :get}):
  
/ dh / passenger / lib / phusion_passenger / rack / request_handler.rb: 92 : in  `process_request '
   / dh / passenger / lib / phusion_passenger / abstract_request_handler.rb: 207 : in  `main_loop '
   / dh / passenger / lib / phusion_passenger / railz / application_spawner.rb: 400 : in  `start_request_handler '
   / dh / passenger / lib / phusion_passenger / railz / application_spawner.rb: 351 : in  `handle_spawn_application '
   / dh / passenger / lib / phusion_passenger / utils.rb: 184 : in  `safe_fork '
   / dh / passenger / lib / phusion_passenger / railz / application_spawner.rb: 349 : in  `handle_spawn_application '
   / dh / passenger / lib / phusion_passenger / abstract_server.rb: 352 : in  ` __send__ '
   / dh / passenger / lib / phusion_passenger / abstract_server.rb: 352 : in  `main_loop '
   / dh / passenger / lib / phusion_passenger / abstract_server.rb: 196 : in  `start_synchronously '
   / dh / passenger / lib / phusion_passenger / abstract_server.rb: 163 : in  `start '
   / dh / passenger / lib / phusion_passenger / railz / application_spawner.rb: 209 : in  `start '
   / dh / passenger / lib / phusion_passenger / spawn_manager.rb: 262 : in  `spawn_rails_application '
   / dh / passenger / lib / phusion_passenger / abstract_server_collection.rb: 126 : in  `lookup_or_add '
   / dh / passenger / lib / phusion_passenger / spawn_manager.rb: 256 : in  `spawn_rails_application '
   / dh / passenger / lib / phusion_passenger / abstract_server_collection.rb: 80 : in  `synchronize '
   / dh / passenger / lib / phusion_passenger / abstract_server_collection.rb: 79 : in  `synchronize '
   / dh / passenger / lib / phusion_passenger / spawn_manager.rb: 255 : in  `spawn_rails_application '
   / dh / passenger / lib / phusion_passenger / spawn_manager.rb: 154 : in  `spawn_application '
   / dh / passenger / lib / phusion_passenger / spawn_manager.rb: 287 : in  `handle_spawn_application '
   / dh / passenger / lib / phusion_passenger / abstract_server.rb: 352 : in  ` __send__ '
   / dh / passenger / lib / phusion_passenger / abstract_server.rb: 352 : in  `main_loop '
   / dh / passenger / lib / phusion_passenger / abstract_server.rb: 196 : in  `start_synchronously '

Rendering 
/ home / walzer / project.cocos2d - x.com / public / 404 .html ( 404  Not Found)


Processing IssuesController
# show (for 999.999.999.99 at 2011-07-09 08:38:49) [GET]
  Parameters: { " action " => " show " " id " => " 62 " " controller " => " issues " }
Rendering template within layouts
/ base
Rendering issues
/ show.rhtml
Completed 
in  831ms (View:  312 , DB:  484 |   200  OK [http: // project.cocos2d - x.com / issues / 62 ]
复制代码

 

In the first paragraph, I create an issue. After that the passenger raise an "internal_error", and would like to find public/internal_error.html. Of course this file isn't exist, it's redmine/public/500.html instead. So I get a 404 error, public/404.html is rendered. In the 3rd paragraph, I refresh the page, and get the issue detail page correctly.


I contact the tech support of dreamhost, but the guy refuse to support problems of redmine. damn... I google this problem, many others met it but have no solutions given in their topics, such as

http://discussion.dreamhost.com/thread-130022.html  (The tech support of dreamhost is just so so..)

http://groups.google.com/group/phusion-passenger/browse_thread/thread/c04394c2bf8440f6 

http://railsforum.com/viewtopic.php?id=36826 (not completely the same)

They're the motion of writing this blog :) 

 

OK, I must DIY now. I know almost nothing about rails, haha. So the breaking point is the 404 page.

 

1. copy 500.html to internal_error.html to avoid 400 error 

After this step, the log looks correctly, but I get a internal_error.html rendered. Actually, I wish it still tell me something more about this error.

 

复制代码
Processing MessagesController # new (for 999.999.999.99 at 2011-07-10 01:47:29) [POST]
  Parameters: { " board_id " => " 11 " " commit " => " Create " " action " => " new " " authenticity_token " => " +KpHpWkhr/4pJQ4tyOgkxtV/CE8tq05r8EM605DLiJE= " " controller " => " messages " " message " => { " subject " => " Another test topic " " content " => " go away 500! damn! " " sticky " => " 0 " " locked " => " 0 " },  " attachments " => { " 1 " => { " description " => "" }}}
Sending email notification to: xxxx@cocos2d
- x.org, yyyy@tranzda.com, zzz@cocos2d - x.org, aaa@cocos2d - x.org, bbbb@cocos2d - x.org, ccccc@gmail.com
Redirected to http:
// www.cocos2d - x.org / boards / 11 / topics / 2290
Completed 
in  2148ms (DB:  38 |   302  Found [http: // www.cocos2d - x.org / boards / 11 / topics / new]


Processing MessagesController
# show (for 999.999.999.99 at 2011-07-10 01:47:34) [GET]
  Parameters: { " board_id " => " 11 " " action " => " show " " id " => " 2290 " " controller " => " messages " }
Rendering template within layouts
/ base
Rendering messages
/ show
Completed 
in  106ms (View:  72 , DB:  20 |   200  OK [http: // www.cocos2d - x.org / boards / 11 / topics / 2290 ]
复制代码

 

I can simply click refresh to get the right page. Why not do it automatically?

 

2. add this code into the header of redmine/public/internal_error.html

复制代码
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd"
>
< head >
    
< META  HTTP-EQUIV ="refresh"  CONTENT ="0" >
</ head >
< html >
< title > Redirect </ title >
< body >
  
< h1 > I can not wait to refresh... </ h1 >
  
< form >
  
< input  type ="button"  onClick ="history.go(0)"  value ="Refresh" >
  
</ form >
</ body >
复制代码

</html> 

Oh nice, when the passenger raises 500 error, it will not invoke public/500.html, but call my custom public/internal_error.html, and refresh to the right page immediately.

 

It's nothing but a small trick. I hope it can help others who meet the same problem :)


本文转自Walzer博客园博客,原文链接:http://www.cnblogs.com/walzer/archive/2011/07/10/2102435.html,如需转载请自行联系原作者


相关文章
|
2月前
|
算法 数据挖掘 数据处理
文献解读-Sentieon DNAscope LongRead – A highly Accurate, Fast, and Efficient Pipeline for Germline Variant Calling from PacBio HiFi reads
PacBio® HiFi 测序是第一种提供经济、高精度长读数测序的技术,其平均读数长度超过 10kb,平均碱基准确率达到 99.8% 。在该研究中,研究者介绍了一种准确、高效的 DNAscope LongRead 管道,用于从 PacBio® HiFi 读数中调用胚系变异。DNAscope LongRead 是对 Sentieon 的 DNAscope 工具的修改和扩展,该工具曾获美国食品药品管理局(FDA)精密变异调用奖。
30 2
文献解读-Sentieon DNAscope LongRead – A highly Accurate, Fast, and Efficient Pipeline for Germline Variant Calling from PacBio HiFi reads
|
3月前
|
算法 数据挖掘
文献解读-Consistency and reproducibility of large panel next-generation sequencing: Multi-laboratory assessment of somatic mutation detection on reference materials with mismatch repair and proofreading deficiency
Consistency and reproducibility of large panel next-generation sequencing: Multi-laboratory assessment of somatic mutation detection on reference materials with mismatch repair and proofreading deficiency,大panel二代测序的一致性和重复性:对具有错配修复和校对缺陷的参考物质进行体细胞突变检测的多实验室评估
32 6
文献解读-Consistency and reproducibility of large panel next-generation sequencing: Multi-laboratory assessment of somatic mutation detection on reference materials with mismatch repair and proofreading deficiency
ERROR: No matching distribution found for gradio>=3.23
该博客文章提供了解决使用pip安装gradio版本3.23时出现的"No matching distribution found"错误的步骤,包括从官网下载相应的whl文件并手动安装。
ERROR: No matching distribution found for gradio>=3.23
|
5月前
|
Ubuntu Linux Python
UserWarning: Glyph 27668 (\N{CJK UNIFIED IDEOGRAPH-6C14}) missing from current font.
UserWarning: Glyph 27668 (\N{CJK UNIFIED IDEOGRAPH-6C14}) missing from current font.
249 2
|
机器学习/深度学习 异构计算 索引
PyG学习笔记2-CREATING MESSAGE PASSING NETWORKS
PyG学习笔记2-CREATING MESSAGE PASSING NETWORKS
380 0
PyG学习笔记2-CREATING MESSAGE PASSING NETWORKS
UserWarning: Glyph 28857 (\N{CJK UNIFIED IDEOGRAPH-70B9}) missing from current font. FigureCanvasA
UserWarning: Glyph 28857 (\N{CJK UNIFIED IDEOGRAPH-70B9}) missing from current font. FigureCanvasA
UserWarning: Glyph 28857 (\N{CJK UNIFIED IDEOGRAPH-70B9}) missing from current font. FigureCanvasA
|
算法 Java BI
【论文阅读】(2013)A goal-driven approach to the 2D bin packing and variable-sized bin packing problems
【论文阅读】(2013)A goal-driven approach to the 2D bin packing and variable-sized bin packing problems
173 0
【论文阅读】(2013)A goal-driven approach to the 2D bin packing and variable-sized bin packing problems
|
机器学习/深度学习 算法 数据挖掘
Paper:He参数初始化之《Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet C》的翻译与解读
Paper:He参数初始化之《Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification》的翻译与解读
PAT (Advanced Level) Practice - 1096 Consecutive Factors(20 分)
PAT (Advanced Level) Practice - 1096 Consecutive Factors(20 分)
147 0
|
Shell
Solving environment: failed with initial frozen solve. Retrying with flexible solve的解决方法
Solving environment: failed with initial frozen solve. Retrying with flexible solve的解决方法
13142 0
Solving environment: failed with initial frozen solve. Retrying with flexible solve的解决方法

热门文章

最新文章