Project

General

Profile

Actions

Defect #27560

closed

RJS is messing up Nginx proxy for static files

Added by Erwin Mueller over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
UI
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate
Affected version:

Description

I have a simple Redmine+Nginx setup and I upgraded to the latest Redmine version. I see that the following is not working:

  • issues: switch version, switch tracker
  • custom field: switch format
  • probably a lot more

The issue is that I have the following Nginx configuration:

location ~* ^.+\.(?:css|js|jpe?g|gif|htc|ico|png|html)$

That is fairly common to serve static files directly and make use of Nginx speed. But it breaks RJS apparently.

Because you have this requests:

<script>
//<![CDATA[

$('#custom_field_field_format').change(function(){
  $.ajax({
    url: '/custom_fields/new.js',
    type: 'get',
    data: $('#custom_field_form').serialize(),
    complete: toggleDisabledInit
  });
});

//]]>
</script>

And Nginx returns a 404:

nginx_1    | 2017/11/18 09:50:09 [error] 18#18: *53 open() "/var/www/html/public/custom_fields/new.js" failed (2: No such file or directory), client: 192.168.80.1, server: _, request: "GET /custom_fields/new.js?utf8=%E2%9C%93&authenticity_token=xBi4lllxH%2FNxCGxOPy1355fFA8Z5nvJ6cUKKuOJm3UjR13XVRk0jmPwbEIM1qQcXjxPkJuxr8e3l6tzKK%2BGL%2Bw%3D%3D&custom_field%5Bfield_format%5D=bool&custom_field%5Bname%5D=Affected+Version&custom_field%5Bdescription%5D=&custom_field%5Bmin_length%5D=&custom_field%5Bmax_length%5D=&custom_field%5Bregexp%5D=&custom_field%5Btext_formatting%5D=&custom_field%5Bdefault_value%5D=&custom_field%5Burl_pattern%5D=&custom_field%5Bis_required%5D=0&custom_field%5Bis_required%5D=1&custom_field%5Bis_filter%5D=0&custom_field%5Bis_filter%5D=1&custom_field%5Bsearchable%5D=0&custom_field%5Bsearchable%5D=1&custom_field%5Bvisible%5D=1&custom_field%5Brole_ids%5D%5B%5D=&custom_field%5Btracker_ids%5D%5B%5D=1&custom_field%5Btracker_ids%5D%5B%5D=&custom_field%5Bis_for_all%5D=0&custom_field%5Bproject_ids%5D%5B%5D=&type=IssueCustomField HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/custom_fields/new?utf8=%E2%9C%93&type=IssueCustomField" 

Nginx sees a request to new.js and thinks it's a static file and tries to serve it directly.

RJS shouldn't be used anyway: #15560

Workaround:

Add a new location for new.js and let it serve from the Rails server.

location ~* ^.+new\.js$ {
  proxy_pass http://redmine:3000;

Related issues

Is duplicate of Redmine - Defect #17770: very simple fix: that causes many sites to break, and much confusion - incorrect use of .js suffixNew

Actions
Actions #1

Updated by Erwin Mueller over 6 years ago

RJS shouldn't be used anyway: #15560

Of course that's just a suggestion :) Renaming new.js to something like new.rjs would also be nice.

Actions #2

Updated by Toshi MARUYAMA over 6 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

Duplicate of #17770.

Actions #3

Updated by Toshi MARUYAMA over 6 years ago

  • Is duplicate of Defect #17770: very simple fix: that causes many sites to break, and much confusion - incorrect use of .js suffix added
Actions

Also available in: Atom PDF