How can I get Discourse to generate relative URLs for uploaded images?
I have a site that is available over HTTPS and a TOR .onion and I need a way to get images working for both.
How can I configure Discourse so that upload:// URLs are converted to relative URLs in the <img> tag? Where (which source file) does this URL generation take place?
Uploading works correctly both from the HTTPS domain and the TOR hidden service .onion but the actual HTML generated for a post uses a full URL which is a problem.
I’m assuming somewhere there is some code that does something like
This would require some internal changes, I am somewhat sympathetic cause it makes life a bit easier when changing domain names for sites that do not use A CDN.
Would have to be something like, IF no CDN configured then cook a relative url.
Me gustaría sumarme en favor de los enlaces internos relativos. Actualmente utilizo URLs completas para referenciar, por ejemplo, otro tema en el mismo sitio.
De hecho, nuestro sitio cambió recientemente de dominio (teniendo en cuenta que la redirección está activa actualmente):
Y nuestro nuevo proveedor, Communiteq (anteriormente DiscourseHosting), amablemente logró sed nuestra base de datos para reflejar este cambio.
¿Quizás haya razones técnicas para el estado actual? ¿Podríamos usar algo como %{THIS}/t/000 en el futuro? Como desarrollador, los caminos absolutos suelen ponerme nervioso. También está la cuestión del cambio de http: a https:, que también realizamos (o al menos aplicamos con más estricto rigor) como parte de la migración mencionada anteriormente. Esto parece ser un caso de uso muy similar al de @mreach.
Como siempre, muchas gracias al equipo de Discourse por un producto maravilloso. R.