nginx + fossil configuration problem

Monthadar Al Jaberi monthadar at gmail.com
Wed Nov 21 21:44:11 UTC 2012


I think I got it to work using rewrite.

location /fossil {
            rewrite /fossil/(.*) /$1 break;
            proxy_pass http://localhost:8080;
            proxy_redirect off;
            proxy_set_header Host $host:$proxy_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }


I hope this is a sane solution :)

thank you for your help!
br,

On Wed, Nov 21, 2012 at 10:25 PM, Monthadar Al Jaberi
<monthadar at gmail.com> wrote:
> On Wed, Nov 21, 2012 at 7:53 PM, Francis Daly <francis at daoine.org> wrote:
>> On Wed, Nov 21, 2012 at 07:16:41PM +0100, Monthadar Al Jaberi wrote:
>>
>> Hi there,
>>
>>> So I want localhost/fossil/aaa.
>>>
>>> I moved the working location block inside the default server block:
>>>
>>
>>>       location /fossil/ {
>>>             proxy_pass http://localhost:8080/;
>>
>>>       }
>>
>>> Now all my other cases work except the fossil one.
>>>
>>> When I browse to localhost/fossil/aaa I see that the link changes to:
>>>
>>>  http://localhost//aaa/index
>>>
>>> An extra '/' is added somehow. The page I get is from nginx 404, which
>>> I suppose means nginx did not proxy the request??
>>
>> No, nginx sent the request to fossil, which responded with a http redirect
>> to this url. Then your browser asks nginx for //aaa/index, which does
>> not exist as a file in the right place, hence 404.
>>
>>   curl -i http://localhost/fossil/aaa
>
> I changed this line:
>
> proxy_set_header Host $host;
>
> to:
>
> proxy_set_header Host $host:$proxy_port;
>
> And curl -i http://localhost/fossil/aaa returns:
>
> HTTP/1.1 302 Moved Temporarily
> Server: nginx/1.2.5
> Date: Wed, 21 Nov 2012 21:22:10 GMT
> Content-Type: text/html; charset=utf-8
> Content-Length: 79
> Connection: keep-alive
> Location: http://localhost:8080//aaa/index
> X-Frame-Options: SAMEORIGIN
> Cache-control: no-cache
>
> <html>
> <p>Redirect to Location: http://localhost:8080//aaa/index
> </p>
> </html>
>
> So this redirection is just before calling fossil? Where do the extra
> '/' come from? I read a litte more and found a directive called
> rewrite, should I use it somehow to remove the xtra slash added?
>
> thnx
>
>>
>> to see exactly what comes back.
>>
>> What you (probably) want is for that redirect to be to /fossil/aaa/index,
>> which is (ideally) down to the fossil configuration.
>>
>> Newer versions of fossil tend to handle things a bit better; possibly
>> setting baseurl to http://localhost/fossil (or maybe just /fossil)
>> when you start the fossil service will allow things to work for you.
>>
>> Good luck with it,
>>
>>         f
>> --
>> Francis Daly        francis at daoine.org
>>
>> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>
>
>
> --
> Monthadar Al Jaberi



-- 
Monthadar Al Jaberi



More information about the nginx mailing list