Thursday, August 31, 2017

Re: Bizarre URL behaviour after deploying

You may have a reverse proxy on port 80 that incorrectly rewrites
/(.*) to / both ways.

On Thu, Aug 31, 2017 at 2:10 PM, Bernd Wechner <bernd.wechner@gmail.com> wrote:
> Tom,
>
> So I did a quick test now before retiring after all. And I am pulling my
> hair out now. If I restart lighttpd on port 8000 (the last step to apparent
> convergence) it works. I access both development and webserve sites on:
>
> http://127.0.0.1:8000/
>
> with server local browsers (Chrome on the dev server and Lynx on the
> webserver for lack of a desktop). And they both now have links to:
>
> http://127.0.0.1:8000/list/Player
>
> and the link serves properly on both sites!
>
> Aaargh. Simply moving the web server from port 80 to port 8000 and the
> problem went away. I could tear my hair out here. Again, a small step closer
> to pinning a cause, but not much close to understanding the reason. The site
> wants to run on 80 not 8000.
>
> So I guess more empirical tests on the morrow or weekend will include moving
> runserver onto port 80 (after checking my dev box doesn't have something
> listing there already ;-) to see if it develops the problem) and a close
> look at the code to see if I can find any port dependencies?
>
> I call Twilight Zone of this so far.
>
> Remember, this:
>
> http://127.0.0.1/Leaderboards/list/Player
>
> also works consistently on port 80, that is the menu presents that URL from
>
> <a href="{% url 'list' 'Player' %}">Players</a>
>
> and it serves that URL albeit it serves all URLS
>
> http://127.0.0.1/whatever/list/Player
>
> identically.
>
> And on port 8000 that menu presents the URL:
>
> http://127.0.0.1:8000/list/Player
>
> and serves it.
>
> The only difference is one config line in lighttpd.conf:
>
> server.port = 80
>
> vs
>
> server.port = 8000
>
> with a a lighttpd restart ("sudo /etc/init.d/lighttpd restart") between.
> Some code paths differ based on port it seems,
>
> I'll go find a wall to bang my head on now ;-).
>
> Regards,
>
> Bernd.
>
>
> 'Tom Evans' via Django users wrote:
>
> On Thu, Aug 31, 2017 at 2:09 AM, Bernd Wechner <bernd.wechner@gmail.com>
> wrote:
>> Daniel,
>>
>> Yes, I have deployed, that is the problem in a sense. URLs are clean in
>> dev
>> and suddenly contain an app_name when deployed.
>>
>> Not sure what you mean by configuration? The Django settings are here:
>>
>> https://github.com/bernd-wechner/CoGs/blob/master/CoGs/settings.py
>>
>> The rest of the config is uwsgi under lighttpd, but none of that is likely
>> to impact the appearance of an app_name in my URLs all of a sudden. I
>> don't
>> mind sharing the config files, but it's a distraction I fear.
>
> I think you will be surprised.
>
> I'm surprised your diagnosis doesn't point you at this straight away,
> if the URLs are correct on one site but incorrect on another site, and
> both sites run the exact same python/django code, then the error is
> certainly in the bits that are different.
>
> Cheers
>
> Tom
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/862e89bd-19ab-1a20-9fcc-8f5152eed92d%40gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Melvyn Sopacua

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Bgw1GUnbnTcqA4TjQTHyOEuy_bZKSDTSsLWfhs8vymPFYneBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment