# Nginx redirection problem in odoo

**URL:** <https://www.ruby-forum.com/t/nginx-redirection-problem-in-odoo/244486>\
**Category:** NGINX\
**Created:** [April 20, 2016, 7:06am UTC](https://www.ruby-forum.com/t/nginx-redirection-problem-in-odoo/244486 "2016-04-20T07:06:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [April 20, 2016, 7:06am UTC](https://www.ruby-forum.com/t/nginx-redirection-problem-in-odoo/244486/1 "2016-04-20T07:06:17Z")

</div>

Hi all:

I’m trying to print a report with product ean13 barcodes and the  
barcodes are printed blank.

I think my problem is an incorrect redirection problem because I can see  
correctly the barcodes if I browse to the url:

[https://mydomain.net/report/barcode/?type=EAN13&value=8435095319553&width=300&height=300&humanreadable=1](https://mydomain.net/report/barcode/?type=EAN13&value=8435095319553&width=300&height=300&humanreadable=1)

MY server response in that case is:

"GET  
/report/barcode/?type=EAN13&value=8435095319553&width=300&height=300&humanreadable=1

HTTP/1.0" 200 -

But if I try to print the report with barcodes my server response is:

"GET  
/report/barcode/?type=EAN13&value=8435095319508&width=600&height=200&humanreadable=1

HTTP/1.0" 302 -  
"GET  
/?redirect=http%3A%2F%[2Fmydomain.com](http://2Fmydomain.com)%2Freport%2Fbarcode%2F%3Ftype%3DEAN13%26value%3D8435095319508%26width%3D600%26height%3D200%26humanreadable%3D1

HTTP/1.0" 302 -

My nginx configuration file:

upstream openerpweb {  
server 127.0.0.1:8069 weight=1 fail\_timeout=300s;  
}

server {  
listen 80;  
server\_name [mydomain.net](http://mydomain.net);  
return 301 https://mydomain.net$request\_uri;  
}

server {  
# server port and name  
listen 443 default;  
server\_name [mydomain.net](http://mydomain.net);  
add\_header Strict-Transport-Security max-age=2592000;

```
  # Specifies the maximum accepted body size of a client request,
  # as indicated by the request header Content-Length.
  client_max_body_size 200m;

  # ssl log files
  access_log /var/log/nginx/openerp-access.log;
  error_log /var/log/nginx/openerp-error.log;

  log_format main '$http_x_forwarded_for - $remote_user 

```

[$time\_local]  
“$host” “$request” ’  
'$status $body\_bytes\_sent “$http\_referer” ’  
‘“$http\_user\_agent” $request\_time’;

```
  # ssl certificate files
  ssl on;
  ssl_certificate /etc/ssl/nginx/server.crt;
  ssl_certificate_key /etc/ssl/nginx/server.key;

  # add ssl specific settings
  keepalive_timeout 60;

  # limit ciphers
  ssl_ciphers HIGH:!ADH:!MD5;
  ssl_protocols SSLv3 TLSv1;
  ssl_prefer_server_ciphers on;

  # increase proxy buffer to handle some OpenERP web requests
  proxy_buffers 16 64k;
  proxy_buffer_size 128k;

  location / {
      proxy_pass http://openerpweb;
      # force timeouts if the backend dies
      proxy_next_upstream error timeout invalid_header http_500

```

http\_502 http\_503;

```
      # set headers
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;

              # set timeouts
              proxy_connect_timeout 600;
              proxy_send_timeout 600;
              proxy_read_timeout 600;
              send_timeout 600;

      # Let the OpenERP web service know that we're using HTTPS,

```

otherwise  
# it will generate URL using http:// and not https://  
proxy\_set\_header X-Forwarded-Proto https;

```
      # by default, do not forward anything
      proxy_redirect off;
  }

  # cache some static data in memory for 60mins.
  # under heavy load this should relieve stress on the OpenERP web

```

interface a bit.  
location ~\* /web/static/ {  
proxy\_cache\_valid 200 60m;  
proxy\_buffering on;  
expires 864000;  
proxy\_pass [http://openerpweb](http://openerpweb);  
}

}

Any idea?

Thanks a lot.

## – Atentament, cubells.
