Defect #13564

Can't upload image

Added by Anton Cherepanov over 6 years ago. Updated over 6 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Attachments
Target version:-
Resolution:Invalid Affected version:2.3.0

Description

Hey everybody, I just updated my redmine to 2.3.0 version
And I founded a problem with image uploading, you can see the error on a attachement

Redmine version                          2.3.0.stable
Ruby version 2.0.0 (x86_64-linux)
Rails version 3.2.13

GAziYvs.png (10.1 KB) Anton Cherepanov, 2013-03-22 19:36

History

#1 Updated by Etienne Massip over 6 years ago

  • Category set to Attachments
  • Status changed from New to Needs feedback
  • Priority changed from High to Normal
  • Resolution set to Cant reproduce

What's in your production.log file?

What browser(s) did you produce this error with?

Does it happen every time? What permission have the user you were connected with?

Do you have plugins installed? Did you try with no plugin installed?

#2 Updated by Anton Cherepanov over 6 years ago

What's in your production.log file? - Just sql logs and rendering
What browser(s) did you produce this error with? - Chrome 25.0.1364.172
Does it happen every time? What permission have the user you were connected with? - yes, files have rwxrwxrwx permissons
Do you have plugins installed? - No

http://www.youtube.com/watch?v=tGt5XJ1WYyM

#3 Updated by Etienne Massip over 6 years ago

Anton Cherepanov wrote:

What's in your production.log file? - Just sql logs and rendering

I meant : what are the lines that appear when you try to upload the file?

What permission have the user you were connected with? - yes, files have rwxrwxrwx permissons

I meant Redmine permissions (via Roles).

#4 Updated by Etienne Massip over 6 years ago

Nevermind, I get it.

Your web frontend Nginx is configured to serve static content and specifically JavaScript content probably based on a pattern/regex basis set somewhat like *.js.

Browser is calling /upload.js for eager file upload, which is a dynamic script generated and returned by the Redmine application, but the call never reach the app because of the HTTP server filter.

You have to configure Nginx to serve itself /javascripts/**/*.js instead of *.js and leave the other .js calls to the application.

#5 Updated by Etienne Massip over 6 years ago

BTW, my filters are just for example and probably not Nginx syntax obviously =)

#6 Updated by Anton Cherepanov over 6 years ago

Could you send lines with that it will be working ? (nginx config)

#7 Updated by Etienne Massip over 6 years ago

No because:
  • I don't know about your present configuration
  • I don't know about Nginx syntax (but I could try a guess if I saw your config)

#8 Updated by Anton Cherepanov over 6 years ago

Default configuration based on redmine wiki

upstream app_server {
 server localhost:3000 fail_timeout=0;
}

server {
 listen 80;
 server_name redmine.xxx.ru;
 root /sites/nginx/redmine.xxx.ru/public;
 location / {
  try_files $uri @ruby;
 }

 location ~* ^.+\.(?:css|js|jpe?g|gif|htc|ico|png|html)$ {
  access_log off;
  expires 30d;
  ## No need to bleed constant updates. Send the all shebang in one
  ## fell swoop.
  tcp_nodelay off;
  ## Set the OS file cache.
  open_file_cache max=3000 inactive=120s;
  open_file_cache_valid 45s;
  open_file_cache_min_uses 2;
  open_file_cache_errors off;
 }

 location @ruby {
  proxy_set_header  X-Real-IP  $remote_addr;
  proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header  Host $http_host;
  proxy_redirect off;
  proxy_read_timeout 300;
  proxy_pass http://app_server;
 }
}

#9 Updated by Etienne Massip over 6 years ago

This configuration is not accurate enough.

Try replacing static files location regular expression:

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

with:

location ~* ^(?:(?:plugin_assets/|themes/).+/)(?:javascripts|stylesheets|images)/.+\.(?:css|js|jpe?g|gif|htc|ico|png|html)$ {

This should work with Redmine 2.x.

The Redmine wiki page must be a contributed HowTo so it'll be great if you could update it once your configuration is Ok.

#10 Updated by Etienne Massip over 6 years ago

Etienne Massip wrote:

location ~* ^(?:(?:plugin_assets/|themes/).+/)(?:javascripts|stylesheets|images)/.+\.(?:css|js|jpe?g|gif|htc|ico|png|html)$ {

location ~* ^(?:(?:plugin_assets/|themes/).+/)(?:javascripts/.+\.js|stylesheets/.+\.css|images/.+\.(?:jpe?g|gif|htc|ico|png|html))$ {

Would even be more accurate.

#11 Updated by Etienne Massip over 6 years ago

Etienne Massip wrote:

location ~* ^(?:(?:plugin_assets/|themes/).+/)(?:javascripts/.+\.js|stylesheets/.+\.css|images/.+\.(?:jpe?g|gif|htc|ico|png|html))$ {

Would even be more accurate.

Except I miss the "html" thing and "htc" is useless:

location ~* ^favicon.ico|(?:(?:plugin_assets/|themes/).+/)(?:.+\.html|javascripts/.+\.js|stylesheets/.+\.css|images/.+\.(?:jpe?g|gif|ico|png))$ {

#12 Updated by Anton Cherepanov over 6 years ago

thanks! it is working =)

#13 Updated by Anton Cherepanov over 6 years ago

but it does not work in issue info - thumbnails

#15 Updated by Etienne Massip over 6 years ago

I think it's because of your previous static assets cache rule, try refreshing after emptying your browser cache?

Disclaimer edit: this is probably a stupid statement

#16 Updated by Etienne Massip over 6 years ago

Have a look to your production.log contents.

#17 Updated by Etienne Massip over 6 years ago

  • Status changed from Needs feedback to Closed
  • Resolution changed from Cant reproduce to Invalid

Anyway, it's a configuration issue.

Please update the HowTo accordingly or point us to the HowTo in the wiki so we can do it.

Also available in: Atom PDF