glanceapp/glance · error

no `{REQUEST-URL}` placeholder specified

Error message

no `{REQUEST-URL}` placeholder specified

What it means

Thrown by the reddit widget's initialize() when request-url-template is non-empty but does not contain the literal {REQUEST-URL} placeholder. The template exists to wrap/redirect the underlying Reddit request URL (e.g. through an SSRF-friendly mirror or proxy), and Glance performs a plain substring check for the placeholder it will substitute.

Source

Thrown at internal/glance/widget-reddit.go:81

	}

	if widget.CollapseAfter == 0 || widget.CollapseAfter < -1 {
		widget.CollapseAfter = 5
	}

	s := widget.SortBy
	if s != "hot" && s != "new" && s != "top" && s != "rising" {
		widget.SortBy = "hot"
	}

	p := widget.TopPeriod
	if p != "hour" && p != "day" && p != "week" && p != "month" && p != "year" && p != "all" {
		widget.TopPeriod = "day"
	}

	if widget.RequestURLTemplate != "" {
		if !strings.Contains(widget.RequestURLTemplate, "{REQUEST-URL}") {
			return errors.New("no `{REQUEST-URL}` placeholder specified")
		}
	}

	a := &widget.AppAuth
	if a.Name != "" || a.ID != "" || a.Secret != "" {
		if a.Name == "" || a.ID == "" || a.Secret == "" {
			return errors.New("application name, client ID and client secret are required")
		}
		a.enabled = true
	}

	widget.
		withTitle("r/" + widget.Subreddit).
		withTitleURL("https://www.reddit.com/r/" + widget.Subreddit + "/").
		withCacheDuration(30 * time.Minute)

	return nil
}

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Include the exact literal {REQUEST-URL} in the template, e.g. request-url-template: 'https://mirror.example.com?url={REQUEST-URL}'
  2. Remove request-url-template entirely if direct access to reddit.com works for you

Example fix

# before
- type: reddit
  subreddit: selfhosted
  request-url-template: https://mirror.example.com/reddit

# after
- type: reddit
  subreddit: selfhosted
  request-url-template: 'https://mirror.example.com?url={REQUEST-URL}'
Defensive patterns

Strategy: validation

Validate before calling

PLACEHOLDER = '{REQUEST-URL}'
tmpl = w.get('request-url-template')
if tmpl is not None and PLACEHOLDER not in tmpl:
    raise ValueError(f'request-url-template must contain the literal {PLACEHOLDER}')

Prevention

When it happens

Trigger: request-url-template: https://mirror.example.com/reddit (missing the placeholder); using single braces with spaces like { REQUEST-URL }; using a Go-template syntax like {{.RequestURL}} instead of the literal {REQUEST-URL}.

Common situations: Routing Reddit traffic through a mirror or proxy that changed its URL scheme; adapting a template from an older example with different placeholder casing (the check is case-sensitive).

Related errors


AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15). Data as JSON: /api/errors/88522510976f290b. Report an issue: GitHub.