I configured a logo in the site settings, but the logo’s URL is missing the default port, i.e. the logo URL looks like this http://localhost/uploads/… rather than http://localhost:3000/uploads/….
I’m starting the development server like this:
RAILS_ENV=development bundle exec rails server
I found that Discourse.base_url is set to "http://localhost" and in config/database.yml, I find this note for the development.hostnames key:
### Don't include the port number here.
Change the "port" site setting instead, at /admin/site_settings.
However, such a site setting does not exist. What do I do?
It’s the default, though, isn’t it? That one has to set the hidden port setting is not at all obvious, hence seeing a logo in the development environment not load is unexpected. In other words, setting a custom logo should just work.
Ich hatte gestern beim Einrichten einer Dev-Site das entgegengesetzte Problem wie der ursprüngliche Beitragende: Ich betreibe meinen Dev-Server hinter einem Nginx-Proxy und möchte daher saubere URLs, aber egal was ich in meinen Einstellungen änderte, Discourse fügte :3000 zu vielen meiner internen Links hinzu, einschließlich des Site-Logos. Schließlich habe ich herausgefunden, dass dies auf die Zeilen 291–293 in lib/discourse.rb zurückzuführen ist:
if Rails.env.development? && SiteSetting.port.blank?
url << ":#{ENV["UNICORN_PORT"] || 3000}"
end
Durch Auskommentieren dieser Zeilen funktionieren mein Logo und andere Links korrekt, obwohl ich nicht weiß, ob dies langfristig zu anderen Problemen führen kann. Es scheint doch etwas kontraintuitiv, SiteSetting.port auf diese Weise zu überschreiben.
Ich habe das noch etwas ausprobiert, und es scheint, dass alles tatsächlich korrekt funktioniert, wenn ich einfach SiteSetting.port = 443 setze und das Häkchen bei „HTTPS erzwingen