♻️ Simple & Efficient Gemini-to-HTTP Proxy fuwn.net
proxy gemini-protocol protocol gemini http rust
at main 207 lines 4.8 kB view raw view rendered
1# Configuration 2 3The configuration for September is managed entirely through environment variables. 4 5## `PORT` 6 7Bind September to a custom port. 8 9Generally, you shouldn't touch this option if you are deploying using Docker. 10 11If no `PORT` is provided or the `PORT` could not be parsed appropriately as an 12unsigned 16-bit integer, `PORT` will default to `80`. 13 14```dotenv 15PORT=1337 16``` 17 18## `ROOT` 19 20Root Gemini capsule to proxy when not visiting a "/proxy" route 21 22If no `ROOT` is provided, `ROOT` will default to `"gemini://fuwn.me"`. 23 24```dotenv 25ROOT=gemini://fuwn.me 26``` 27 28## `CSS_EXTERNAL` 29 30A comma-separated list of external CSS files to apply to the HTML response 31 32If no `CSS_EXTERNAL` value is provided, a default stylesheet of 33[LaTeX.css](https://latex.vercel.app/) and the styles within 34[`default.css`](./default.css) will be applied. 35 36```dotenv 37CSS_EXTERNAL=https://cdnjs.cloudflare.com/ajax/libs/mini.css/3.0.1/mini-default.min.css 38``` 39 40## `KEEP_GEMINI` 41 42A comma-separated list of Gemini URL fragments to keep as is when proxying. 43 44Wildcards are supported using the `*` character, and exceptions can be made 45using the `!` character 46 47```dotenv 48# These rules ensure that all Gemini URLs will be left untouched in the proxied 49# HTML response except for URLs under the "fuwn.me" domain 50KEEP_GEMINI=!*fuwn.me/*,gemini://* 51``` 52 53## `HEAD` 54 55Insert any string at the end of the HTML `<head>` 56 57```dotenv 58HEAD=<script>/* September */</script><style>/* September */</style> 59``` 60 61## `PROXY_BY_DEFAULT` 62 63Control whether all Gemini URLs are proxied. 64 65Similar to `KEEP_GEMINI_EXACT` and `KEEP_GEMINI_DOMAIN`, but global 66 67This configuration value defaults to `true`. 68 69```dotenv 70PROXY_BY_DEFAULT=false 71``` 72 73## `FAVICON_EXTERNAL` 74 75An external favicon file to apply to the HTML response 76 77```dotenv 78FAVICON_EXTERNAL=https://example.com/favicon.ico 79``` 80 81## `PLAIN_TEXT_ROUTE` 82 83A comma-separated list of paths to treat as plain text routes 84 85These patterns do not support regular expressions, but do support the use of `*` 86as a wildcard. 87 88```dotenv 89PLAIN_TEXT_ROUTE=/robots.txt,/license.txt,*.xml 90``` 91 92## `MATHJAX` 93 94Enable MathJax support for rendering LaTeX within `$` and `$$` delimiters. 95 96This configuration value defaults to `false`. 97 98```dotenv 99MATHJAX=true 100``` 101 102## `HEADER` 103 104Adds a large text header to the top of a proxy page 105 106Only available in styled routes 107 108```dotenv 109HEADER="This string will show up at the top of my proxied capsule." 110``` 111 112## `EMBED_IMAGES` 113 114Embed images in the HTML response if a link to an image is found. 115 116A value of `1` will enable this feature, while keeping a link to the image. 117 118Any non-empty value other than `1` will enable this feature, while removing the link to the image. 119 120```dotenv 121EMBED_IMAGES=2 122``` 123 124## `CONDENSE_LINKS` 125 126Condense adjacent links to a single line 127 128A value of `*` will condense all adjacent links to a single line. 129 130A comma-separated list of paths will condense adjacent links to a single line only on those paths. 131 132### Example 133 134```plaintext 135<!-- Not condensed --> 136 137<p><a href="/">Link</a></p> 138<p><a href="/">Link</a></p> 139<p><a href="/">Link</a></p> 140 141<!-- Condensed --> 142<p><a href="/">Link</a> | <a href="/">Link</a> | <a href="/">Link</a></p> 143``` 144 145## `PRIMARY_COLOUR` 146 147Set the primary colour of elements in the default stylesheet. This field 148controls the colour of items such as links and highlights. 149 150Popular choices are `var(--base0D)` for a blue, or `var(--base09)` for an 151amber colour. 152 153### Examples 154 155```plaintext 156PRIMARY_COLOUR=var(--base09) 157PRIMARY_COLOUR=red 158PRIMARY_COLOUR=#ff0000 159``` 160 161## `HTTP09` 162 163Enable a separate HTTP/0.9 TCP server alongside the main HTTP server 164 165HTTP/0.9 is the simplest version of HTTP. Requests are a bare `GET /path` line, 166and responses are the raw body with no status line or headers. The server returns 167the proxied Gemini content directly (text/gemini for text, raw bytes for images). 168 169This configuration value defaults to `false`. 170 171```dotenv 172HTTP09=true 173``` 174 175## `HTTP09_PORT` 176 177Bind the HTTP/0.9 server to a custom port 178 179If no `HTTP09_PORT` is provided or it could not be parsed appropriately as an 180unsigned 16-bit integer, `HTTP09_PORT` will default to `90`. 181 182```dotenv 183HTTP09_PORT=9009 184``` 185 186### Testing 187 188```sh 189echo "GET /" | nc localhost 9009 190curl --http0.9 http://localhost:9009/ 191``` 192 193## `CONDENSE_LINKS_AT_HEADING` 194 195This configuration option is similar to `CONDENSE_LINKS`, but only condenses 196links found under specific headings. 197 198For instance, I condense the few links I have on my index page under the 199"# Fuwn[.me]" heading, and I condense my quick links/navigation panel under the 200"## Quick Links" heading. 201 202This way, I don't accidentally condense my entire sitemap, which could be 203hundreds of links long, but I do condense my quick links on every page. 204 205```dotenv 206CONDENSE_LINKS_AT_HEADINGS="## Quick Links,# Fuwn[.me]" 207```