This seems to be the reverse of the "GOOD" at:
http://wiki.nginx.org/Pitfalls#Using_If

I don't think this is a uwsgi issue, unless you have uwsgi doing some
sort of further redirecting after the fact.

You may want to test your nginx redirect with plain static html files
and confirm that it's working first and then maybe afterwards see if
there's something further going on with uwsgi.

On Tue, May 12, 2015 at 2:34 PM, James <[email protected]> wrote:
> Hello,
>
> I'm trying to setup a redirect from naked domain to www. However, no matter
> the source url, it always redirects to the root domain no matter where I
> came from, for example:
>
> domain.com -> www.domain.com (This is correct behaviour)
> domain.com/test.html -> www.domain.com (This is wrong)
> domain.com/login.html -> www.domain.com (This is wrong)
>
> This is the code I am using in nginx to handle the redirect:
>
> server {
>     listen       80;
>     server_name  domain.com;
>     return       301 http://www.domain.com$request_uri;
> }
> server {
>     listen       80;
>     server_name  www.domain.com;
>     ...
>
> Can anyone please explain why this might be happening? It seems the
> $request_uri isn't doing anything. This is my UWSGI config:
>
> [uwsgi]
> uid = user
> gid = group
> socket = 127.0.0.1:8001
> processes = 4
> chdir = /var/www/app
> virtualenv = /var/www/app/venv
> pythonpath = /var/www/app/venv/bin/python
> module = run
> callable = app
> master = 1
> daemonize = /var/log/app.log
> logto = /var/log/uwsgi.log
>
> Any help would be appreciated.
>
> James
>
> _______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to