commit links in hg rss feeds point to localhost

12 views
Skip to first unread message

Nitrox

unread,
Aug 21, 2012, 7:48:26 AM8/21/12
to merc...@selenic.com

The rss feeds (both rss and atom) generated by hg, links to commit point to localhost. I tried setting baseurl under web section in hgrc to hg.fanboy.co.nz and also / but it doesn't seem to have any effect.

you can see them on https://hg.fanboy.co.nz/atom-log and https://hg.fanboy.co.nz/rss-log
We run nginx as frontend server with uWsgi.

uWsgi config.

#!/usr/bin/env python
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb('/var/repos/adblock')

hgrc config

[web]
baseurl = /
name = Fanboy Adblock
deny_push =
description = Fanboy Adblock List Repo
encoding = UTF-8

I did try setting baseurl to http://hg.fanboy.co.nz but it doesn't work either.

nginx config

   server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
        uwsgi_pass hg_uwsgi;
        include uwsgi_params;
        uwsgi_param SCRIPT_NAME /;
        uwsgi_param UWSGI_SCRIPT hgweb;
        uwsgi_modifier1 30;
        }

         location /static/ {
        rewrite       /static/(.*)  /$1 break;
        root          /usr/local/lib/python2.7/dist-packages/mercurial/templates/static;
        expires 30d;
    }

upstream hg_uwsgi {
server unix:/var/repos/hg.sock;
}

Any help appreciated.

Thanks.

Matt Mackall

unread,
Aug 22, 2012, 4:39:49 PM8/22/12
to Nitrox, merc...@selenic.com
On Tue, 2012-08-21 at 12:48 +0100, Nitrox wrote:
> The rss feeds (both rss and atom) generated by hg, links to commit point to
> localhost. I tried setting baseurl under web section in hgrc to
> hg.fanboy.co.nz and also / but it doesn't seem to have any effect.
>
> you can see them on https://hg.fanboy.co.nz/atom-log and
> https://hg.fanboy.co.nz/rss-log
> We run nginx as frontend server with uWsgi.

I suspect this is the problem. Mercurial depends on getting the server's
address in the WSGI environment as part of the request. You seem to have
a setup where Nginx is proxying to uWSGI, so Mercurial sees uWSGI's
internal address (localhost) as the server name, not Nginx's visible
address.

This is a bit special for RSS/Atom, as the links are all absolute rather
than relative. You can either try to ensure that SERVER_NAME gets set
properly, or change all instances of '{urlbase}' in the templates to the
URL you need.

--
Mathematics is the supreme nostalgia of our time.


_______________________________________________
Mercurial mailing list
Merc...@selenic.com
http://selenic.com/mailman/listinfo/mercurial

Nitrox

unread,
Aug 23, 2012, 5:31:05 AM8/23/12
to Matt Mackall, merc...@selenic.com
Thank you Matt. Setting the Server_Name on nginx fixed everything.
Reply all
Reply to author
Forward
0 new messages