Broken Image In Posts?


(Clever Moniker) #1

So I know there is another topic on this, but the research I’ve done hasn’t solved the problem. :frowning:

I can upload an image, but once I leave he topic and come back, the image is broken.

I’m running off of DigitalOcean, installed using the official guide (NOT one-click install), and running off root domain (checked settings and everything seems correct).

Any ideas what might be going on?

Thanks so much,
CM


(Régis Hanol) #2

What are the URLs of the images when they’re broken?


#3

CleverMoniker here, I had to log in using a different moniker since Facebook gave me a “Check Point” when I logged in as CleverMoniker through Discourse. That was brutal.

Anyways, to explain what was going on… I was using a www. domain BUT Discourse was storing and displaying the images under non-www. I was unaware it even mattered…

All I did was reconfigure DigitalOcean’s domain to non-www and setup a nginx redirect. Now I see the images and we’re all good.

I’m confused as to why it even matters though?


(Régis Hanol) #4

http://your-domain.com is indeed not the same as http://www.your-domain.com.

If you misconfigured your Discourse (ie. used http://www. for your Discourse, but configured it with http://) then it’s normal all your images broke once Discourse has cooked the posts.


#5

I configured Discourse with no http:// or www, just… example.com.

DigitalOcean’s domain was setup “www” which linked to the ipaddress. I’d log in on www.example.com, post and image, and Discourse would cook it under the non-www. So basically yeah, you’re right. :slight_smile:

If I may, maybe a note should be made on the official install? Something like, “setup an nginx redirect after install etc.” as maybe others like me who a new to this wouldn’t know why their images were broken.


(Rafael dos Santos Silva) #6

A nginx redirect is not needed if the Discourse hostname is configured properly on app.yml.


#7

I understand.

All I’m saying here is, a new person like me will (most likely) view domains as “www” and will set up the DNS at DigitalOcean using it.

Discourse’s install clearly states:
Hostname for your Discourse? [discourse.example.com]: <-- most people here will copy the example and not place a www in front of the domain name.

Now they’ve kinda messed themselves without realizing it. All I’m saying is, you guys are all super knowledgeable and stuff, maybe a little bit of hand holding can help out the new people. :slight_smile: