Welcome! Log In Create A New Profile

Advanced

Re: nginx + fossil configuration problem

Monthadar Al Jaberi
November 21, 2012 04:46PM
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@gmail.com> wrote:
> On Wed, Nov 21, 2012 at 7:53 PM, Francis Daly <francis@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@daoine.org
>>
>> _______________________________________________
>> nginx mailing list
>> nginx@nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>
>
>
> --
> Monthadar Al Jaberi



--
Monthadar Al Jaberi

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx + fossil configuration problem

Monthadar Al Jaberi November 20, 2012 04:30PM

Re: nginx + fossil configuration problem

Francis Daly November 20, 2012 06:26PM

Re: nginx + fossil configuration problem

Monthadar Al Jaberi November 21, 2012 01:18PM

Re: nginx + fossil configuration problem

Monthadar Al Jaberi November 21, 2012 01:34PM

Re: nginx + fossil configuration problem

Francis Daly November 21, 2012 01:56PM

Re: nginx + fossil configuration problem

Monthadar Al Jaberi November 21, 2012 04:26PM

Re: nginx + fossil configuration problem

Monthadar Al Jaberi November 21, 2012 04:46PM

Re: nginx + fossil configuration problem

Francis Daly November 21, 2012 05:44PM

Re: nginx + fossil configuration problem

Francis Daly November 21, 2012 05:20PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 301
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready