Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#20520 closed Bug (invalid)

Bug when using nginx+apache not listening on 80 port.

Reported by: himikhimik@… Owned by: nobody
Component: HTTP handling Version: 1.4
Severity: Normal Keywords: nginx apache
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I made nginx and apache servers working together.
Nginx is listening on 81 port, serving all media files and passing all other requests to apache.
Apache is listening on 88 port and serving all other requests by means of wsgi.py.

When one makes GET request all work ok. But when one makes POST with redirect to another
page the redirect leads to 80 port instead of 81 port (when just saving any object on django admin site).

The problem is incorrect forming POST headers.
django/http/utils.py -> fix_location_header function.
If do comment the string

  response["Location"] = request.build_absolute_uri(response["Location"])

the POST requests work ok.

There are my config files.
nginx.conf:

server {

    listen 81;

    access_log /var/log/nginx/vertex.access.log;
    error_log /var/log/nginx/vertex.error.log;

    location /static/ {
        alias /srv/vertex/media/admin_static/;
        expires 30d;
    }

    location /site-media/ {
        alias /srv/vertex/media/;
        expires 30d;
    }

    location / {
        proxy_pass http://127.0.0.1:88/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

}

apache2.conf:

Listen 88

<VirtualHost *:88>

    WSGIDaemonProcess localhost python-path=/srv/vertex/src:/srv/vertex/env/lib/python2.7/site-packages
    WSGIProcessGroup localhost

    WSGIScriptAlias / /srv/vertex/src/wsgi.py

    <Directory /srv/vertex/src>
        <Files wsgi.py>
            Order deny,allow
            Allow from all
        </Files>
    </Directory>

</VirtualHost>

Change History (3)

comment:1 Changed 2 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Version changed from 1.5 to 1.4

comment:2 Changed 2 years ago by himikhimik@…

  • Resolution set to invalid
  • Status changed from new to closed

comment:3 Changed 2 years ago by himikhimik@…

Resolved by removing wrong nginx.conf properties with proxy_set_header directive.

Note: See TracTickets for help on using tickets.
Back to Top