Il giorno lunedì 2 febbraio 2015 12:29:00 UTC+1, alex ha scritto:
>
> Michele, 
>
> Thank you for quick answer! 
>
> If I put in nginx server directive: 
>
> location ~ ^/AAA(/.*)?$ { rewrite ^.*$ http://example.com/app/ctr/fnc 
> break ; }
>
> and leave web2py/applications/app/routes.py with only 
>
> routes_out = (
>     ('/app/ctr/fnc', r'/AAA'),
> )
>
> everytime I call /AAA it gets rewritten to /app/ctr/fnc.
> Instead, I would like to see always /AAA 
>
>
>
I think you should post a minimal "server" directive to reproduce the 
problem.
Don't use complete URI's (i.e. with https part) or you are likely to get an 
http redirection. This should get closer to you need: 

location /AAA { rewrite ^/AAA/.*$ /a/c/f last; }

location / { uwsgi|scgi|fcgi handler section }
 

> On the other hand, if I remove the rewrite from nginx server directive, 
> and I leave both routes_in and routes_out as described before in 
> /app/routes.py, it works but randomly. 
>
> Once every two or three times I refresh the page, I get:
>
> "invalid request"
>
>
>
>
> On Mon, Feb 2, 2015 at 7:50 PM, Michele Comitini <[email protected] 
> <javascript:>> wrote:
>
>> you still need your routes.py in place:
>>
>> routes_out = (
>>     ('/app/ctr/fnc', r'/AAA'),
>>
>> )
>>
>>
>> 2015-02-02 11:23 GMT+01:00 al ex <[email protected] <javascript:>>:
>>
>>> I have setup this route in /web2py/applications/app
>>>
>>> routes_in = (
>>>     (r'/AAA/?', '/app/ctr/fnc'),
>>> )
>>>
>>> routes_out = (
>>>     ('/app/ctr/fnc', r'/AAA'),
>>>
>>> )
>>>
>>>
>>> With rockets, on localhost, it works fine. 
>>>
>>> On production server nginx 1.7.9, uwsgi 2.0.8, python 2.7.6, if I 
>>> repeatedly refresh /AAA, sometimes it work, sometimes it gives: "invalid 
>>> request".
>>>
>>> This goes apparently randomly. 
>>>
>>> How to isolate and solve this problem? 
>>> I thought maybe trying to eliminate routes.py, and mimic the same rules 
>>> on nginx, could give me a hint. 
>>>
>>> routes_in would go to 
>>>
>>> location ~ ^/AAA(/.*)?$ { rewrite ^.*$ http://example.com/app/ctr/fnc 
>>> break ; }
>>>
>>> but how to write route_out in this case? 
>>>
>>>
>>>  -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected] <javascript:>.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to