Can't upload images when domain name is an IP address

AI-generated summary

A user, FUNix_IT_Nguyen_Ba_N, reported an issue where images uploaded to their Discourse instance, hosted on Digital Ocean via an IP address (128.199.222.14), were not displaying correctly. The image URLs were malformed, appearing with an extra double slash (e.g., //http://...) instead of the standard protocol-relative or absolute path. Nathaniel_Mattocks offered to investigate the site but noted limitations without admin access. After clarifying the hosting provider and the specific URL error, Steven identified the root cause as a configuration error in the app.yml file. He advised ensuring the DISCOURSE_HOSTNAME variable on line ~57 was set strictly to '128.199.222.14' without additional protocol prefixes or slashes. FUNix_IT_Nguyen_Ba_N confirmed that applying this fix resolved the issue, allowing images to upload and display correctly, and thanked the community for their assistance.

Hi every one, Im newbie.

I set up the Discourse under the IP http://128.199.222.14/.

But when i upload image, the image url change to the picture below and it can not display?

Can all you guys can help me to fix that.

I sovled that: Change http://128.199.222.14/ to 128.199.222.14 in app.yml

I will have a look on your site… I’m the user Nathanielmattock. :wink:

Okay i will active you because i did not set up email sending yet.

Hmm… What service do you use to host your data?

I use digital ocean.

The URL you upload is
http://128.199.222.14//uploads/default/original/1X/9a7032754d4a24aa23222a5961753a0bed74ffb5.jpg

It’s work but in my site it’s converted to ‘//http://128.199.222.14//uploads/default/original/1X/9a7032754d4a24aa23222a5961753a0bed74ffb5.jpg’

I dont know why it added more two slashes before the origin URL.

I think i will rebuild again and set IP just is 128.199.222.14

I might need the admin or at least moderator status to view some of the setup, unless someone that does support can…

I think it could be an error in the file app.yml

Line ~57 you should have

DISCOURSE_HOSTNAME: '128.199.222.14'

Nothing more

Okay it’s exactly. I finish fixed it.:smiley:

I finished that. Thanks for your help.:smiley: