dbt-labs / dbt-labs/hub.getdbt.com

Static Assets Use Absolute URLs Instead of Relative URLs

Open
#3,892 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
SCSS
Stars
33
Forks
34
Avg merge
50m
Merged PRs (30d)
52

Description

# Summary

When hosting hub.getdbt.com behind a reverse proxy or in a custom environment, static assets (e.g., JS, CSS) are prefixed with the absolute static_url (e.g., https://hub.getdbt.com/image/...), causing broken references when the site is served from a different domain or path.

# Problem

Currently, all static assets are referenced using a static_url prefix, which is hardcoded to be either:
- http://localhost:4567 (in dev)
- https://hub.getdbt.com (in prod)
This approach causes problems when deploying the site behind a reverse proxy or on a custom domain (e.g., `https://internal.myorg.com/dbt-hub`), as the asset URLs still point to the original domain.

# Suggested Fix
- Remove the hardcoded static_url prefix from asset links and instead:
- Use relative URLs in templates and static references
- Optionally allow configuring a base_path or asset_prefix if advanced customization is needed
eg;

```diff
--- a/source/_nav.erb
+++ b/source/_nav.erb
-
+
```

or in config.rb -
```
set :host, ENV[''MM_HOST] || 'hub.getdbt.com'
set :base_prefix ENV['MM_BASE_PREFIX'] || "/"
...
helpers do
def host_with_port
[[config[:host], config[:base_prefix]].compact.join("/"), optional_port].compact.join(':')
end

def optional_port
config[:port] unless [80, 443].include? config[:port].to_i
end

def site_url
config[:protocol] + host_with_port
end
end
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.