code: func (app *App) context(w http.ResponseWriter, r *http.Request) *Context {
  	ctx := r.Context()
  	ctx = dcontext.WithVars(ctx, r)
  	ctx = dcontext.WithLogger(ctx, dcontext.GetLogger(ctx,
  		"vars.name",
  		"vars.reference",
  		"vars.digest",
  		"vars.uuid"))
  
  	context := &Context{
  		App:     app,
  		Context: ctx,
  	}
  
  	if app.httpHost.Scheme != "" && app.httpHost.Host != "" {
  		// A "host" item in the configuration takes precedence over
  		// X-Forwarded-Proto and X-Forwarded-Host headers, and the
  		// hostname in the request.
  		context.urlBuilder = v2.NewURLBuilder(&app.httpHost, false)
  	} else {
  		context.urlBuilder = v2.NewURLBuilderFromRequest(r, app.Config.HTTP.RelativeURLs)
  	}
  
  	return context
  }
docs: // context constructs the context object for the application. This only be
  // called once per request.