Skip to content
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

500 Internal Server Error #110

Open
einhander opened this issue Jun 3, 2020 · 13 comments
Open

500 Internal Server Error #110

einhander opened this issue Jun 3, 2020 · 13 comments

Comments

@einhander
Copy link

If tree view enabled by deafault, switch from project to its parrent project cause error 500.
Relevant part of log:

Processing by IssuesController#index as HTML
  Parameters: {"project_id"=>"another_test"}
  Current user: admin (id=6)
Completed 500 Internal Server Error in 9ms (ActiveRecord: 2.4ms)
  
ArgumentError (bad argument (expected URI object or URI string)):
  
plugins/redmine_issues_tree/lib/redmine_issues_tree/issues_controller_patch.rb:10:in `index'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'

My system is:

Environment:
  Redmine version                4.0.4.stable
  Ruby version                   2.5.5-p157 (2019-03-15) [x86_64-linux-gnu]
  Rails version                  5.2.3
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Git                            2.20.1
  Filesystem                     
Redmine plugins:
  redmine_gemavatar              1.1
  redmine_impersonate            2.0.0
  redmine_issue_templates        0.3.7
  redmine_issues_tree            0.0.14
  redmine_ldap_sync              2.2.0
  redmine_static_link            0.1.0

Issue tree plugin is from 4.0x branch.

@einhander
Copy link
Author

Uups, right rights, didn't resolve an issue

@einhander einhander reopened this Jun 3, 2020
@Loriowar
Copy link
Owner

Loriowar commented Jun 3, 2020

@einhander please, provide full callstack for the 500 error. I'll take a look at this in closest future.

@einhander
Copy link
Author

Is it sufficient?

Started GET "/redmine/projects/another_test/issues" for 192.168.0.12 at 2020-06-03 11:59:14 +0300
Processing by IssuesController#index as HTML
  Parameters: {"project_id"=>"another_test"}
  Current user: admin (id=6)
Completed 500 Internal Server Error in 9ms (ActiveRecord: 2.6ms)
  
ArgumentError (bad argument (expected URI object or URI string)):
  
plugins/redmine_issues_tree/lib/redmine_issues_tree/issues_controller_patch.rb:10:in `index'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'
Started GET "/redmine/projects/another_test?jump=issues" for 192.168.0.12 at 2020-06-03 11:59:33 +0300
Processing by ProjectsController#show as HTML
  Parameters: {"jump"=>"issues", "id"=>"another_test"}
  Current user: admin (id=6)
Redirected to http://example.com/redmine/projects/another_test/issues
Completed 302 Found in 33ms (ActiveRecord: 25.1ms)
Started GET "/redmine/projects/another_test/issues" for 192.168.0.12 at 2020-06-03 11:59:33 +0300
Processing by IssuesController#index as HTML
  Parameters: {"project_id"=>"another_test"}
  Current user: admin (id=6)
Completed 500 Internal Server Error in 10ms (ActiveRecord: 2.8ms)
  
ArgumentError (bad argument (expected URI object or URI string)):
  
plugins/redmine_issues_tree/lib/redmine_issues_tree/issues_controller_patch.rb:10:in `index'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'

@einhander
Copy link
Author

Hello @Loriowar, any updates for this issue?

@Loriowar
Copy link
Owner

@einhander I can't reproduce on fresh Redmine 4.0.4 installation with plugin from 4.0.x branch. Please, provide full callstack or any other details of the error. Moreover, this can be related with kind of AdBlock or other similar browser plugins for block side activities an hide user info. Most likely, your extension block referer header. So, I suppose, this is not a problem of current plugin, this is problem of your installation or your particular env. Please, check it carefully.

@einhander
Copy link
Author

So, I suppose, this is not a problem of current plugin, this is problem of your installation or your particular env.

I use reverse proxy for redmine, so this may be the source of error.

ProxyPass                                   http://redmine.ip/redmine
ProxyPassReverse                      http://redmine.ip/redmine
ProxyPassReverseCookiePath   /redmine /redmine

Everything works as expected, beside this plugin.
AdBlock is disabled for tests.

Here is debug output with proxy:

Started GET "/redmine/projects/lab112?jump=issues" for 192.168.0.12 at 2020-06-29 18:03:56 +0300
Processing by ProjectsController#show as HTML
  Parameters: {"jump"=>"issues", "id"=>"lab112"}
  Token Update All (17.2ms)  UPDATE `tokens` SET `tokens`.`updated_on` = '2020-06-29 18:03:56' WHERE `tokens`.`user_id` = 6 AND `tokens`.`value` = 'c5061ebbeabba110f3ffce6a2bc23013b9236aba' AND `tokens`.`action` = 'session' AND (updated_on > '2020-06-29 06:03:56.497850')
   (0.4ms)  SELECT MAX(`settings`.`updated_on`) FROM `settings`
  User Load (0.5ms)  SELECT  `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`status` = 1 AND `users`.`id` = 6 LIMIT 1
  Current user: admin (id=6)
  Project Load (0.4ms)  SELECT  `projects`.* FROM `projects` WHERE `projects`.`identifier` = 'lab112' LIMIT 1
   (0.4ms)  SELECT `enabled_modules`.`name` FROM `enabled_modules` WHERE `enabled_modules`.`project_id` = 9
Redirected to http://external.com/redmine/projects/lab112/issues
Completed 302 Found in 28ms (ActiveRecord: 19.0ms)
Started GET "/redmine/projects/lab112/issues" for 192.168.0.12 at 2020-06-29 18:03:56 +0300
Processing by IssuesController#index as HTML
  Parameters: {"project_id"=>"lab112"}
  Token Update All (0.8ms)  UPDATE `tokens` SET `tokens`.`updated_on` = '2020-06-29 18:03:56' WHERE `tokens`.`user_id` = 6 AND `tokens`.`value` = 'c5061ebbeabba110f3ffce6a2bc23013b9236aba' AND `tokens`.`action` = 'session' AND (updated_on > '2020-06-29 06:03:56.540145')
   (0.5ms)  SELECT MAX(`settings`.`updated_on`) FROM `settings`
  User Load (0.4ms)  SELECT  `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`status` = 1 AND `users`.`id` = 6 LIMIT 1
  Current user: admin (id=6)
  Project Load (0.4ms)  SELECT  `projects`.* FROM `projects` WHERE `projects`.`identifier` = 'lab112' LIMIT 1
   (0.4ms)  SELECT `enabled_modules`.`name` FROM `enabled_modules` WHERE `enabled_modules`.`project_id` = 9
Completed 500 Internal Server Error in 10ms (ActiveRecord: 2.5ms)
  
ArgumentError (bad argument (expected URI object or URI string)):
  
plugins/redmine_issues_tree/lib/redmine_issues_tree/issues_controller_patch.rb:10:in `index'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'<Paste>

And this without proxy

started GET "/redmine/projects/lab112?jump=issues" for 192.168.0.12 at 2020-06-29 18:05:21 +0300
Processing by ProjectsController#show as HTML
Parameters: {"jump"=>"issues", "id"=>"lab112"}
Token Update All (20.5ms)  UPDATE `tokens` SET `tokens`.`updated_on` = '2020-06-29 18:05:21' WHERE `tokens`.`user_id` = 6 AND `tokens`.`value` = 'b8c9480ca19522f597919869173bd7813546da39' AND `tokens`.`action` = 'session' AND (updated_on > '2020-06-29 06:05:21.245026')
(0.5ms)  SELECT MAX(`settings`.`updated_on`) FROM `settings`
User Load (0.4ms)  SELECT  `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`status` = 1 AND `users`.`id` = 6 LIMIT 1
Current user: admin (id=6)
Project Load (0.4ms)  SELECT  `projects`.* FROM `projects` WHERE `projects`.`identifier` = 'lab112' LIMIT 1
(0.4ms)  SELECT `enabled_modules`.`name` FROM `enabled_modules` WHERE `enabled_modules`.`project_id` = 9
Redirected to http://redmine.ip/redmine/projects/lab112/issues
Completed 302 Found in 31ms (ActiveRecord: 22.1ms)
Started GET "/redmine/projects/lab112/issues" for 192.168.0.12 at 2020-06-29 18:05:21 +0300
Processing by IssuesController#index as HTML
Parameters: {"project_id"=>"lab112"}
Token Update All (0.7ms)  UPDATE `tokens` SET `tokens`.`updated_on` = '2020-06-29 18:05:21' WHERE `tokens`.`user_id` = 6 AND `tokens`.`value` = 'b8c9480ca19522f597919869173bd7813546da39' AND `tokens`.`action` = 'session' AND (updated_on > '2020-06-29 06:05:21.285030')
(0.4ms)  SELECT MAX(`settings`.`updated_on`) FROM `settings`
User Load (0.5ms)  SELECT  `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`status` = 1 AND `users`.`id` = 6 LIMIT 1
Current user: admin (id=6)
Project Load (0.5ms)  SELECT  `projects`.* FROM `projects` WHERE `projects`.`identifier` = 'lab112' LIMIT 1
(0.4ms)  SELECT `enabled_modules`.`name` FROM `enabled_modules` WHERE `enabled_modules`.`project_id` = 9
Redirected to http://redmine.ip/redmine/projects/lab112/issues_trees/tree_index
Completed 302 Found in 11ms (ActiveRecord: 2.5ms)
Started GET "/redmine/projects/lab112/issues_trees/tree_index" for 192.168.0.12 at 2020-06-29 18:05:21 +0300
Processing by IssuesTreesController#tree_index as HTML
Parameters: {"project_id"=>"lab112"}
Token Update All (0.7ms)  UPDATE `tokens` SET `tokens`.`updated_on` = '2020-06-29 18:05:21' WHERE `tokens`.`user_id` = 6 AND `tokens`.`value` = 'b8c9480ca19522f597919869173bd7813546da39' AND `tokens`.`action` = 'session' AND (updated_on > '2020-06-29 06:05:21.304323')
(0.5ms)  SELECT MAX(`settings`.`updated_on`) FROM `settings`
User Load (0.5ms)  SELECT  `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`status` = 1 AND `users`.`id` = 6 LIMIT 1
Current user: admin (id=6)
Project Load (0.4ms)  SELECT  `projects`.* FROM `projects` WHERE `projects`.`identifier` = 'lab112' LIMIT 1
(0.4ms)  SELECT `enabled_modules`.`name` FROM `enabled_modules` WHERE `enabled_modules`.`project_id` = 9
IssueCustomField Load (0.5ms)  SELECT `custom_fields`.* FROM `custom_fields` WHERE `custom_fields`.`type` IN ('IssueCustomField') AND (is_for_all = TRUE OR EXISTS (SELECT 1 FROM custom_fields_projects cfp JOIN projects p ON p.id = cfp.project_id WHERE cfp.custom_field_id = custom_fields.id AND p.lft >= 7 AND p.rgt <= 10)) ORDER BY `custom_fields`.`position` ASC
Tracker Load (0.4ms)  SELECT DISTINCT `trackers`.* FROM `trackers` INNER JOIN `projects_trackers` ON `projects_trackers`.`tracker_id` = `trackers`.`id` INNER JOIN `projects` ON `projects`.`id` = `projects_trackers`.`project_id` INNER JOIN `enabled_modules` ON `enabled_modules`.`project_id` = `projects`.`id` WHERE (projects.status <> 9) AND `enabled_modules`.`name` = 'issue_tracking' AND (projects.lft >= 7 AND projects.rgt <= 10) AND (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em.name='issue_tracking')) ORDER BY `trackers`.`position` ASC
IssuePriority Load (0.4ms)  SELECT `enumerations`.* FROM `enumerations` WHERE `enumerations`.`type` IN ('IssuePriority') ORDER BY `enumerations`.`position` ASC
IssueCustomField Load (0.5ms)  SELECT `custom_fields`.* FROM `custom_fields` WHERE `custom_fields`.`type` IN ('IssueCustomField') AND (is_for_all = TRUE OR EXISTS (SELECT 1 FROM custom_fields_projects cfp JOIN projects p ON p.id = cfp.project_id WHERE cfp.custom_field_id = custom_fields.id AND p.lft >= 7 AND p.rgt <= 10)) AND `custom_fields`.`is_filter` = TRUE ORDER BY `custom_fields`.`position` ASC
CustomField Load (0.4ms)  SELECT `custom_fields`.* FROM `custom_fields` WHERE `custom_fields`.`is_filter` = TRUE
Project Load (0.4ms)  SELECT `projects`.* FROM `projects` WHERE (projects.lft > 7 AND projects.rgt < 10) AND `projects`.`status` = 1 ORDER BY `projects`.`lft` ASC
SQL (0.6ms)  SELECT `issues`.`id` AS t0_r0, `issues`.`tracker_id` AS t0_r1, `issues`.`project_id` AS t0_r2, `issues`.`subject` AS t0_r3, `issues`.`description` AS t0_r4, `issues`.`due_date` AS t0_r5, `issues`.`category_id` AS t0_r6, `issues`.`status_id` AS t0_r7, `issues`.`assigned_to_id` AS t0_r8, `issues`.`priority_id` AS t0_r9, `issues`.`fixed_version_id` AS t0_r10, `issues`.`author_id` AS t0_r11, `issues`.`lock_version` AS t0_r12, `issues`.`created_on` AS t0_r13, `issues`.`updated_on` AS t0_r14, `issues`.`start_date` AS t0_r15, `issues`.`done_ratio` AS t0_r16, `issues`.`estimated_hours` AS t0_r17, `issues`.`parent_id` AS t0_r18, `issues`.`root_id` AS t0_r19, `issues`.`lft` AS t0_r20, `issues`.`rgt` AS t0_r21, `issues`.`is_private` AS t0_r22, `issues`.`closed_on` AS t0_r23, `issue_statuses`.`id` AS t1_r0, `issue_statuses`.`name` AS t1_r1, `issue_statuses`.`is_closed` AS t1_r2, `issue_statuses`.`position` AS t1_r3, `issue_statuses`.`default_done_ratio` AS t1_r4, `projects`.`id` AS t2_r0, `projects`.`name` AS t2_r1, `projects`.`description` AS t2_r2, `projects`.`homepage` AS t2_r3, `projects`.`is_public` AS t2_r4, `projects`.`parent_id` AS t2_r5, `projects`.`created_on` AS t2_r6, `projects`.`updated_on` AS t2_r7, `projects`.`identifier` AS t2_r8, `projects`.`status` AS t2_r9, `projects`.`lft` AS t2_r10, `projects`.`rgt` AS t2_r11, `projects`.`inherit_members` AS t2_r12, `projects`.`default_version_id` AS t2_r13, `projects`.`default_assigned_to_id` AS t2_r14 FROM `issues` INNER JOIN `projects` ON `projects`.`id` = `issues`.`project_id` INNER JOIN `issue_statuses` ON `issue_statuses`.`id` = `issues`.`status_id` WHERE (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em.name='issue_tracking')) AND ((issues.status_id IN (SELECT id FROM issue_statuses WHERE is_closed=FALSE)) AND projects.lft >= 7 AND projects.rgt <= 10) ORDER BY issues.id DESC
IssuePriority Load (0.4ms)  SELECT `enumerations`.* FROM `enumerations` WHERE `enumerations`.`type` IN ('IssuePriority') AND `enumerations`.`id` IN (2, 4, 3) ORDER BY `enumerations`.`position` ASC
Tracker Load (0.4ms)  SELECT `trackers`.* FROM `trackers` WHERE `trackers`.`id` IN (4, 2)
Principal Load (0.5ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 6
(0.5ms)  SELECT SUM(`time_entries`.`hours`) AS sum_hours, `time_entries`.`issue_id` AS time_entries_issue_id FROM `time_entries` INNER JOIN `projects` ON `projects`.`id` = `time_entries`.`project_id` WHERE (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em.name='time_tracking')) AND `time_entries`.`issue_id` IN (24, 23, 21, 20, 19, 18) GROUP BY `time_entries`.`issue_id`
CACHE Project Load (0.0ms)  SELECT `projects`.* FROM `projects` WHERE (projects.lft > 7 AND projects.rgt < 10) AND `projects`.`status` = 1 ORDER BY `projects`.`lft` ASC
SQL (0.5ms)  SELECT `issues`.`id` AS t0_r0, `issues`.`tracker_id` AS t0_r1, `issues`.`project_id` AS t0_r2, `issues`.`subject` AS t0_r3, `issues`.`description` AS t0_r4, `issues`.`due_date` AS t0_r5, `issues`.`category_id` AS t0_r6, `issues`.`status_id` AS t0_r7, `issues`.`assigned_to_id` AS t0_r8, `issues`.`priority_id` AS t0_r9, `issues`.`fixed_version_id` AS t0_r10, `issues`.`author_id` AS t0_r11, `issues`.`lock_version` AS t0_r12, `issues`.`created_on` AS t0_r13, `issues`.`updated_on` AS t0_r14, `issues`.`start_date` AS t0_r15, `issues`.`done_ratio` AS t0_r16, `issues`.`estimated_hours` AS t0_r17, `issues`.`parent_id` AS t0_r18, `issues`.`root_id` AS t0_r19, `issues`.`lft` AS t0_r20, `issues`.`rgt` AS t0_r21, `issues`.`is_private` AS t0_r22, `issues`.`closed_on` AS t0_r23, `issue_statuses`.`id` AS t1_r0, `issue_statuses`.`name` AS t1_r1, `issue_statuses`.`is_closed` AS t1_r2, `issue_statuses`.`position` AS t1_r3, `issue_statuses`.`default_done_ratio` AS t1_r4, `projects`.`id` AS t2_r0, `projects`.`name` AS t2_r1, `projects`.`description` AS t2_r2, `projects`.`homepage` AS t2_r3, `projects`.`is_public` AS t2_r4, `projects`.`parent_id` AS t2_r5, `projects`.`created_on` AS t2_r6, `projects`.`updated_on` AS t2_r7, `projects`.`identifier` AS t2_r8, `projects`.`status` AS t2_r9, `projects`.`lft` AS t2_r10, `projects`.`rgt` AS t2_r11, `projects`.`inherit_members` AS t2_r12, `projects`.`default_version_id` AS t2_r13, `projects`.`default_assigned_to_id` AS t2_r14 FROM `issues` INNER JOIN `projects` ON `projects`.`id` = `issues`.`project_id` INNER JOIN `issue_statuses` ON `issue_statuses`.`id` = `issues`.`status_id` WHERE (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em.name='issue_tracking')) AND ((issues.status_id IN (SELECT id FROM issue_statuses WHERE is_closed=FALSE)) AND projects.lft >= 7 AND projects.rgt <= 10) AND (issues.parent_id NOT IN (24, 23, 21, 20, 19, 18) OR issues.parent_id IS NULL) ORDER BY issues.id DESC
CACHE IssuePriority Load (0.0ms)  SELECT `enumerations`.* FROM `enumerations` WHERE `enumerations`.`type` IN ('IssuePriority') AND `enumerations`.`id` IN (2, 4, 3) ORDER BY `enumerations`.`position` ASC
Tracker Load (0.5ms)  SELECT `trackers`.* FROM `trackers` WHERE `trackers`.`id` IN (2, 4)
CACHE Principal Load (0.0ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 6
(0.5ms)  SELECT SUM(`time_entries`.`hours`) AS sum_hours, `time_entries`.`issue_id` AS time_entries_issue_id FROM `time_entries` INNER JOIN `projects` ON `projects`.`id` = `time_entries`.`project_id` WHERE (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em.name='time_tracking')) AND `time_entries`.`issue_id` IN (23, 19, 18) GROUP BY `time_entries`.`issue_id`
Rendering plugins/redmine_issues_tree/app/views/issues_trees/tree_index.html.erb within layouts/base
Tracker Exists (0.5ms)  SELECT  1 AS one FROM `trackers` INNER JOIN `projects_trackers` ON `trackers`.`id` = `projects_trackers`.`tracker_id` WHERE `projects_trackers`.`project_id` = 9 LIMIT 1
Rendered plugins/redmine_issues_tree/app/views/issues_trees/_link_to_plain_view.html.haml (0.5ms)
Tracker Load (0.5ms)  SELECT DISTINCT `trackers`.* FROM `trackers` INNER JOIN `projects_trackers` ON `projects_trackers`.`tracker_id` = `trackers`.`id` INNER JOIN `projects` ON `projects`.`id` = `projects_trackers`.`project_id` INNER JOIN `enabled_modules` ON `enabled_modules`.`project_id` = `projects`.`id` WHERE (projects.status <> 9) AND `enabled_modules`.`name` = 'issue_tracking' AND (projects.lft >= 7 AND projects.rgt <= 10) ORDER BY `trackers`.`position` ASC
(0.5ms)  SELECT DISTINCT `workflows`.`old_status_id`, `workflows`.`new_status_id` FROM `workflows` WHERE `workflows`.`type` IN ('WorkflowTransition') AND `workflows`.`tracker_id` IN (1, 2, 4, 5)
IssueStatus Load (0.5ms)  SELECT `issue_statuses`.* FROM `issue_statuses` WHERE `issue_statuses`.`id` IN (1, 2, 3, 4, 5, 6) ORDER BY `issue_statuses`.`position` ASC
Rendered queries/_filters.html.erb (15.6ms)
Rendered queries/_columns.html.erb (2.8ms)
Rendered plugins/redmine_issues_tree/app/views/issues_trees/_query_form.html.erb (21.3ms)
CACHE Project Load (0.0ms)  SELECT `projects`.* FROM `projects` WHERE (projects.lft > 7 AND projects.rgt < 10) AND `projects`.`status` = 1 ORDER BY `projects`.`lft` ASC
(0.4ms)  SELECT SUM(`issues`.`estimated_hours`) FROM `issues` INNER JOIN `projects` ON `projects`.`id` = `issues`.`project_id` INNER JOIN `issue_statuses` ON `issue_statuses`.`id` = `issues`.`status_id` WHERE (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em.name='issue_tracking')) AND ((issues.status_id IN (SELECT id FROM issue_statuses WHERE is_closed=FALSE)) AND projects.lft >= 7 AND projects.rgt <= 10)
CACHE Project Load (0.0ms)  SELECT `projects`.* FROM `projects` WHERE (projects.lft > 7 AND projects.rgt < 10) AND `projects`.`status` = 1 ORDER BY `projects`.`lft` ASC
(0.5ms)  SELECT SUM(time_entries.hours) FROM `issues` INNER JOIN `projects` ON `projects`.`id` = `issues`.`project_id` INNER JOIN `issue_statuses` ON `issue_statuses`.`id` = `issues`.`status_id` INNER JOIN `time_entries` ON `time_entries`.`issue_id` = `issues`.`id` WHERE (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em.name='issue_tracking')) AND ((issues.status_id IN (SELECT id FROM issue_statuses WHERE is_closed=FALSE)) AND projects.lft >= 7 AND projects.rgt <= 10) AND (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em.name='time_tracking'))
Group Load (0.5ms)  SELECT `users`.* FROM `users` INNER JOIN `groups_users` ON `users`.`id` = `groups_users`.`group_id` WHERE `users`.`type` IN ('Group', 'GroupBuiltin', 'GroupAnonymous', 'GroupNonMember') AND `groups_users`.`user_id` = 6
Issue Exists (0.4ms)  SELECT  1 AS one FROM `issues` WHERE `issues`.`parent_id` = 23 AND `issues`.`id` IN (24, 23, 21, 20, 19, 18) LIMIT 1
UserPreference Load (0.4ms)  SELECT  `user_preferences`.* FROM `user_preferences` WHERE `user_preferences`.`user_id` = 6 LIMIT 1
Rendered plugins/redmine_issues_tree/app/views/issues_trees/_tree_node.html.erb (8.1ms)
Issue Exists (0.5ms)  SELECT  1 AS one FROM `issues` WHERE `issues`.`parent_id` = 19 AND `issues`.`id` IN (24, 23, 21, 20, 19, 18) LIMIT 1
Rendered plugins/redmine_issues_tree/app/views/issues_trees/_tree_node.html.erb (3.8ms)
Issue Exists (0.4ms)  SELECT  1 AS one FROM `issues` WHERE `issues`.`parent_id` = 18 AND `issues`.`id` IN (24, 23, 21, 20, 19, 18) LIMIT 1
Rendered plugins/redmine_issues_tree/app/views/issues_trees/_tree_node.html.erb (3.6ms)
Rendered plugins/redmine_issues_tree/app/views/issues_trees/_tree_list.html.erb (23.5ms)
Rendered plugins/redmine_issue_templates/app/views/issue_templates/_issue_template_link.html.erb (1.6ms)
IssueQuery Load (0.4ms)  SELECT `queries`.* FROM `queries` LEFT OUTER JOIN projects ON queries.project_id = projects.id WHERE `queries`.`type` IN ('IssueQuery') AND (queries.project_id IS NULL OR (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = projects.id AND em.name='issue_tracking'))) AND (queries.visibility <> 0 OR queries.user_id = 6) AND (`queries`.`project_id` = 9 OR `queries`.`project_id` IS NULL) ORDER BY `queries`.`name` ASC, `queries`.`id` ASC
Rendered issues/_sidebar.html.erb (4.7ms)
Rendered plugins/redmine_issues_tree/app/views/issues_trees/tree_index.html.erb within layouts/base (64.2ms)
Project Load (0.5ms)  SELECT `projects`.`id`, `projects`.`name`, `projects`.`identifier`, `projects`.`lft`, `projects`.`rgt` FROM `projects` INNER JOIN `members` ON `projects`.`id` = `members`.`project_id` WHERE `members`.`user_id` = 6 AND `projects`.`status` != 9 AND `projects`.`status` = 1
CACHE Tracker Exists (0.0ms)  SELECT  1 AS one FROM `trackers` INNER JOIN `projects_trackers` ON `trackers`.`id` = `projects_trackers`.`tracker_id` WHERE `projects_trackers`.`project_id` = 9 LIMIT 1
Version Exists (0.4ms)  SELECT  1 AS one FROM `versions` INNER JOIN `projects` ON `projects`.`id` = `versions`.`project_id` WHERE (projects.id = 9 OR (projects.status <> 9 AND ( versions.sharing = 'system' OR (projects.lft >= 7 AND projects.rgt <= 10 AND versions.sharing = 'tree') OR (projects.lft < 7 AND projects.rgt > 10 AND versions.sharing IN ('hierarchy', 'descendants')) OR (projects.lft > 7 AND projects.rgt < 10 AND versions.sharing = 'hierarchy')))) LIMIT 1
CACHE Tracker Exists (0.0ms)  SELECT  1 AS one FROM `trackers` INNER JOIN `projects_trackers` ON `trackers`.`id` = `projects_trackers`.`tracker_id` WHERE `projects_trackers`.`project_id` = 9 LIMIT 1
Wiki Load (0.4ms)  SELECT  `wikis`.* FROM `wikis` WHERE `wikis`.`project_id` = 9 LIMIT 1
Board Exists (0.3ms)  SELECT  1 AS one FROM `boards` WHERE `boards`.`project_id` = 9 LIMIT 1
Repository Load (0.3ms)  SELECT  `repositories`.* FROM `repositories` WHERE `repositories`.`project_id` = 9 AND `repositories`.`is_default` = TRUE LIMIT 1
Completed 200 OK in 139ms (Views: 78.3ms | ActiveRecord: 16.7ms)
Started GET "/redmine/gemavatar/6" for 192.168.0.12 at 2020-06-29 18:05:21 +0300
Processing by PicturesController#show as HTML
Parameters: {"user_id"=>"6"}
Token Update All (0.9ms)  UPDATE `tokens` SET `tokens`.`updated_on` = '2020-06-29 18:05:21' WHERE `tokens`.`user_id` = 6 AND `tokens`.`value` = 'b8c9480ca19522f597919869173bd7813546da39' AND `tokens`.`action` = 'session' AND (updated_on > '2020-06-29 06:05:21.554253')
(0.5ms)  SELECT MAX(`settings`.`updated_on`) FROM `settings`
User Load (0.4ms)  SELECT  `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`status` = 1 AND `users`.`id` = 6 LIMIT 1
Current user: admin (id=6)
User Load (0.5ms)  SELECT  `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`id` = 6 LIMIT 1
Picture Load (0.7ms)  SELECT  `pictures`.* FROM `pictures` WHERE `pictures`.`user_id` = 6 ORDER BY `pictures`.`id` ASC LIMIT 1
AuthSourceLdap Load (0.5ms)  SELECT  `auth_sources`.* FROM `auth_sources` WHERE `auth_sources`.`type` IN ('AuthSourceLdap') ORDER BY `auth_sources`.`id` ASC LIMIT 1
(0.7ms)  BEGIN
Picture Create (0.6ms)  INSERT INTO `pictures` (`user_id`, `location`, `created`) VALUES (6, '/usr/share/redmine/plugins/redmine_gemavatar/assets/images/admin.jpg', '2020-06-29')
(26.0ms)  COMMIT
Sent file /usr/share/redmine/plugins/redmine_gemavatar/assets/images/admin.jpg (0.3ms)
Completed 200 OK in 75ms (ActiveRecord: 30.6ms)

It's seems that if proxy is used redmine tries to load issues instead of issues_trees/tree_index.

@Loriowar
Copy link
Owner

May you provide curl command from web-console for request with 500 error? Or, at least, content of all headers for this request? In a best case, you have to slightly debug plugin and add workaround into plugins/redmine_issues_tree/lib/redmine_issues_tree/issues_controller_patch.rb:10 in case of unexpected argument for URI function or, in minimum variant, add puts request.referer into plugins/redmine_issues_tree/lib/redmine_issues_tree/issues_controller_patch.rb:9 or by some other way provide me an incorrect data of this object. Otherwise, I can't make a proper processing due to unknown data type.

In addition, take a look at Apache proxy header config. There can be some analog of proxy_set_header from Nginx .

@einhander
Copy link
Author

Sorry for late response here the curl request:


curl 'https://external.com/redmine/projects/it?jump=issues' -H 'Connection: keep-alive' -H 'Authorization: Basic YWJyYXZvOmJhZUxpTg==' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'Referer: https://external.com/redmine/projects/softwarelist/issues_trees/tree_index' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7' -H 'Cookie: Redmine=RTR2Nk1nalBXRVEzM0dOaFp4L3VFcll1OTR0KzJTUzBWYVV0THEyU1RsRG9hT00xRTZ4MHRiMWZ6TFlCdk9qY0RhZVNDSWpuYXdkczkvM2U0a0pzUlFxdjBoQjlyYVV0MnFqclNqMWRwbDZKSCtwWmt4bWtZT1Y0K2ZBOWlNTEFtVXRFL1huTVZsR3hleHZuNWtCK3k5WnZBalVKeXhxQWZRaml5bWo0eXZBVnhscCtOQ1dZeHZWT0JhK1BRUGo1V1VFcGFJL2ZydXI0SHZMYzd5WVp1OGNqTTVFUEFXK3J0T0lnS2tQK3Z1dnllM0xrZmRnS3hVTzFEaXBJd2x3dGZ3dDJ5N2Z3K3ltTkNMcldKdkx6b040WVpKRUl4NUJWV2FOWFVMK0MzcTloMXkrbjZLa3pBOXJJTkVTemdUeUQ0Ky9XczlrS1YxMU5welZ2REFJU3NWcHZ3aUJRY1Q3N0tkMjB5TWFxSUpTUnY3WFhuM3dsaFdVVFB5c0FFQnF1eGhxMXpOSWNCSXFvRm9FQTdLWkVDMnFCMXdBS2tUK3BSclZ6R082WXVYNExYSmFLdlhxL002YUdkQXNGcWg1VlR1SkwzOXNTYk52MTBkZ2NxOU5JWjJsVUhuakY2NlA1d2toZlJ5TXNBcVc3cEx3cXNCalZYeTZEWUdaUkNabmFVNWhQbFlLSlJMSGg4enovOHp6V1hTKzVNMG5LclJhWHpmd0ZwdkxqVmhsREdManQ3MGwzNWUyQzByczZRbkpWZC83bkdWUTlyT0kwR1liY0FFUGc4QT09LS0zZGlrRlBNK0NqS3F5dEdiYmlERjVBPT0%3D--39d51615a4946c6298c4f4b8fe71c4f8095e69cc' --compresse://external.com/redmine/projects/it?jump=issues' -H 'Connection: keep-alive' -H 'Authorization: Basic YWJyYXZvOmJhZUxpTg==' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'Referer: https://external.com/redmine/projects/softwarelist/issues_trees/tree_index' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7' -H 'Cookie: Redmine=RTR2Nk1nalBXRVEzM0dOaFp4L3VFcll1OTR0KzJTUzBWYVV0THEyU1RsRG9hT00xRTZ4MHRiMWZ6TFlCdk9qY0RhZVNDSWpuYXdkczkvM2U0a0pzUlFxdjBoQjlyYVV0MnFqclNqMWRwbDZKSCtwWmt4bWtZT1Y0K2ZBOWlNTEFtVXRFL1huTVZsR3hleHZuNWtCK3k5WnZBalVKeXhxQWZRaml5bWo0eXZBVnhscCtOQ1dZeHZWT0JhK1BRUGo1V1VFcGFJL2ZydXI0SHZMYzd5WVp1OGNqTTVFUEFXK3J0T0lnS2tQK3Z1dnllM0xrZmRnS3hVTzFEaXBJd2x3dGZ3dDJ5N2Z3K3ltTkNMcldKdkx6b040WVpKRUl4NUJWV2FOWFVMK0MzcTloMXkrbjZLa3pBOXJJTkVTemdUeUQ0Ky9XczlrS1YxMU5welZ2REFJU3NWcHZ3aUJRY1Q3N0tkMjB5TWFxSUpTUnY3WFhuM3dsaFdVVFB5c0FFQnF1eGhxMXpOSWNCSXFvRm9FQTdLWkVDMnFCMXdBS2tUK3BSclZ6R082WXVYNExYSmFLdlhxL002YUdkQXNGcWg1VlR1SkwzOXNTYk52MTBkZ2NxOU5JWjJsVUhuakY2NlA1d2toZlJ5TXNBcVc3cEx3cXNCalZYeTZEWUdaUkNabmFVNWhQbFlLSlJMSGg4enovOHp6V1hTKzVNMG5LclJhWHpmd0ZwdkxqVmhsREdManQ3MGwzNWUyQzByczZRbkpWZC83bkdWUTlyT0kwR1liY0FFUGc4QT09LS0zZGlrRlBNK0NqS3F5dEdiYmlERjVBPT0%3D--39d51615a4946c6298c4f4b8fe71c4f8095e69cc' --compressed

headers

GET /redmine/projects/it?jump=issues HTTP/1.1
Host: external.com
Connection: keep-alive
Authorization: Basic YWJyYXZvOmJhZUxpTg==
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: https://external.com/redmine/projects/softwarelist/issues_trees/tree_index
Accept-Encoding: gzip, deflate, br
Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: Redmine=RTR2Nk1nalBXRVEzM0dOaFp4L3VFcll1OTR0KzJTUzBWYVV0THEyU1RsRG9hT00xRTZ4MHRiMWZ6TFlCdk9qY0RhZVNDSWpuYXdkczkvM2U0a0pzUlFxdjBoQjlyYVV0MnFqclNqMWRwbDZKSCtwWmt4bWtZT1Y0K2ZBOWlNTEFtVXRFL1huTVZsR3hleHZuNWtCK3k5WnZBalVKeXhxQWZRaml5bWo0eXZBVnhscCtOQ1dZeHZWT0JhK1BRUGo1V1VFcGFJL2ZydXI0SHZMYzd5WVp1OGNqTTVFUEFXK3J0T0lnS2tQK3Z1dnllM0xrZmRnS3hVTzFEaXBJd2x3dGZ3dDJ5N2Z3K3ltTkNMcldKdkx6b040WVpKRUl4NUJWV2FOWFVMK0MzcTloMXkrbjZLa3pBOXJJTkVTemdUeUQ0Ky9XczlrS1YxMU5welZ2REFJU3NWcHZ3aUJRY1Q3N0tkMjB5TWFxSUpTUnY3WFhuM3dsaFdVVFB5c0FFQnF1eGhxMXpOSWNCSXFvRm9FQTdLWkVDMnFCMXdBS2tUK3BSclZ6R082WXVYNExYSmFLdlhxL002YUdkQXNGcWg1VlR1SkwzOXNTYk52MTBkZ2NxOU5JWjJsVUhuakY2NlA1d2toZlJ5TXNBcVc3cEx3cXNCalZYeTZEWUdaUkNabmFVNWhQbFlLSlJMSGg4enovOHp6V1hTKzVNMG5LclJhWHpmd0ZwdkxqVmhsREdManQ3MGwzNWUyQzByczZRbkpWZC83bkdWUTlyT0kwR1liY0FFUGc4QT09LS0zZGlrRlBNK0NqS3F5dEdiYmlERjVBPT0%3D--39d51615a4946c6298c4f4b8fe71c4f8095e69cc

add puts request.referer into
2.log

I hope this helps.

@georgmu
Copy link

georgmu commented May 19, 2022

I ran into the same issue:
The tree plugin fails to work if I set Referer-Policy to no-referrer in my nginx configuration for the host.

Reason for this header is to avoid information leak on external links. Unfortunately there is no setting to send referrer only for same-origin links, so the plan is to run in no-referrer mode.

Wouldn't it be possible to somehow deal with the problem that the referrer is absent?

I can even reproduce the issue without the Referer-Policy header, if you - instead of clicking the link of the overview page (/projects/foo/issues?set_filter=1&tracker_id=1) - copy the link and paste it into the address bar of a new browser tab.

@LSA-ENZ
Copy link

LSA-ENZ commented Oct 16, 2024

Hi there!

I see it's an old issue but just detected in my Redmine 5.1. I guess it might be solved by replacing if skip_issues_tree_redirect == 'true' || URI(request.referer).path == with if skip_issues_tree_redirect == 'true' || (request.referer && (URI(request.referer).path == both in lines 12 and 24 of issues_controller_patch.rb (mine is version 0.0.15).

I'll give it a try when I can.

@einhander
Copy link
Author

Thank you @LSA-ENZ , I'll try it, on my old redmine installation.

@LSA-ENZ
Copy link

LSA-ENZ commented Oct 17, 2024

Ok, @einhander. It does work in my Redmine, indeed.

@LSA-ENZ
Copy link

LSA-ENZ commented Oct 17, 2024

Trying to provide with a PR, I see the change is already proposed in #128 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants