2012/12/6 Richard Hipp <[email protected]>

> I have your requests (both this on and FOSSIL_USERS).  I'm a little busy
> now fixing problems on other systems.  Remind me if I fail to get back to
> this within a few days.
>
>
> On Thu, Dec 6, 2012 at 1:15 PM, Maxim Khitrov <[email protected]> wrote:
>
>> On Thu, Dec 6, 2012 at 7:56 AM, Maxim Khitrov <[email protected]> wrote:
>> > Found a way around the problem with the following nginx configuration:
>> >
>> > location / {
>> >         proxy_pass http://localhost:8080/;
>> >         proxy_redirect http:// https://;
>> >
>> >         proxy_set_header Host $host;
>> >         proxy_set_header X-Real-IP $remote_addr;
>> >         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>> >
>> >         sub_filter http://<server_name> https://<server_name>;
>> > }
>> >
>> > Replace "<server_name>" in the sub_filter line, the variable
>> > $server_name doesn't seem to be working. This trick requires you to
>> > have the ngx_http_sub_module compiled:
>> >
>> > http://nginx.org/en/docs/http/ngx_http_sub_module.html
>> >
>> > A cleaner solution would be better, but I guess this will do for now.
>> >
>> > - Max
>>
>> Ignore all of this, simply using "proxy_set_header HTTPS on;" is the
>> clean solution that I was looking for. While I was digging through the
>> cgi.c source, I also made a 2-line modification that allows for proper
>> handling of the X-Real-IP header. Would it be possible to get this
>> patch into the main tree?
>>
>> - Max
>>
>> --- src/cgi.c.orig      2012-12-06 13:07:39.000000000 -0500
>> +++ src/cgi.c   2012-12-06 13:07:44.000000000 -0500
>> @@ -1212,6 +1212,8 @@
>>  #endif
>>      }else if( fossil_strcmp(zFieldName,"user-agent:")==0 ){
>>        cgi_setenv("HTTP_USER_AGENT", zVal);
>> +    }else if( fossil_strcmp(zFieldName,"x-real-ip:")==0 ){
>> +      cgi_replace_parameter("REMOTE_ADDR", mprintf("%s",zVal));
>>      }
>>    }
>>
>

I had the same issue, an ugly way to do this is to remove $home or
replace it by $baseurl in src/style.c and src/skin.c.

Then put it in nginx configuration:
      location ~ ^/fossil/([^\/]*)(.*)$ {
        proxy_pass         http://127.0.0.1:8080/$1$2;
        proxy_redirect     off;

        proxy_set_header   Host             "$host/fossil";
        proxy_set_header   X-Real-IP           $remote_addr;
        proxy_set_header   X-Forwarded-For     $proxy_add_x_forwarded_for;
        proxy_set_header   SCRIPT_NAME             "/$1";
      }
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to