git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [cgit PATCH] use Host: header to generate cgit_hosturl

From
LHLars Hjemli <hjemli@gmail.com>
Date
Sep 1, 2008, 20:36 UTC
Message-ID
<8c5c35580809011336v58b139acu5078cafd3440c786@mail.gmail.com>
In-Reply-To
<20080901063033.GA21848@untitled>
On Mon, Sep 1, 2008 at 8:30 AM, Eric Wong <normalperson@yhbt.net> wrote:
Show 12 quoted lines
> I run an instance of lighttpd for cgit behind nginx (nginx
> doesn't execute CGI).  So the port (SERVER_PORT=33333) that
> lighttpd runs on sends to cgit is different from the standard
> port 80 that public clients connect to (via nginx).
>
> This was causing the Atom feed URL to show the private port
> number that lighttpd was running on.
>
> Since the HTTP/1.1 "Host" header includes the port number if
> running on a non-standard port, it allows non-client-facing HTTP
> servers to transparently generate public URLs that clients can
> see.
This makes a lot of sense, thanks for the detailed description.
> So use the "Host" header if it is available and fall back to
> SERVER_NAME/SERVER_PORT for some clients that don't set
> HTTP_HOST.

Maybe it would be better to use a new cgitrc parameter as fallback if the client doesn't provide the "Host" header?

-- larsh

Previous: Eric WongNext: Eric Wong
Message 2 of 6 in “use Host: header to generate cgit_hosturl”
  1. use Host: header to generate cgit_hosturlEric Wong, Sep 1, 2008
  2. Lars HjemliSep 1, 2008
  3. Eric WongSep 1, 2008
  4. Lars HjemliSep 1, 2008
  5. Eric WongSep 1, 2008
  6. Lars HjemliSep 2, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.