On Wed, Dec 5, 2012 at 9:56 PM, Maxim Khitrov <[email protected]> wrote:
> Hello,
>
> I have fossil running behind nginx, which is proxying https
> connections to http://localhost:8080/. If I start the server with
> "fossil server /my/repo/dir/" to make all *.fossil repositories
> available, fossil generates wrong links by using the http scheme
> instead of https. However, if I specify the "--baseurl https://.../"
> option, urls such as "https://.../repo/index" are redirected to
> "https://.../index", which obviously doesn't exist.
>
> Is there a way to force fossil to use https in URLs and redirects even
> through the request from nginx comes in on http? A permanent fix might
> be to look at the "X-Forwarded-Proto" header.
>
> - Max
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
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users