Why the icon address is localhost when I use an ip as hostname

I have installed discourse development version on a CentOS 7.7 according to beginners-guide-to-install-discourse-for-development-using-docker/102009
the setup step is:

  1. get source from discourse.git
  2. change config about email sender in config/discourse_default.conf
  3. ./d/boot-env --init
  4. ./d/unicorn

the hostname is set an IP address like: 10.201.0.115
I can access the discourse use 10.201.0.115:9292
but all of the images can’t show.

Failed to load resource: net::ERR_CONNECTION_REFUSED from http://localhost:9292/images/discourse-logo-sketch.png
but I can use http://10.201.0.115:9292/images/discourse-logo-sketch.png to get the png.

any more, the icon of the reply is also can’t get.
I know the cause is the URL must be the ip 10.201.0.115, but not localhost

What do I need to set up? about IP.

Thank you to anyone who helps.

can you help me @pfaffman
thank you very much!

My solution is to use localhost on port 3000. That’s what I recommend.

2 Likes

Thank you very much.
you mean your website is not published to other user.
but I use the discourse to our company, people use the company local network can access the website.
how can I do at this situation?

@pfaffman
you mean: I just need to confige the DISCOURSE_HOSTNAME= localhost in app.yml?
any thing more?
can you give a example of the correct configration ?

You installed the development version, that is a local install to hack on the Discourse source code. It’s not to be used by multiple people to actually use the software.

If you want to use Discourse, follow Discourse official Standard Installation

ok, thank you very much!
but I have installed another version according to the same address as you give me using the discourse_docker.git instead discourse.git.
what we need to do is we can’t use 80 port which has used by another website.
we must use another port instead 80.
we have change the port to 28080, we main website of discourse can access.
but we get another new problem: the icon or png address is not take the new port 28080, it just use the ip to try get the png, you know, it can’t be reached.
the correct png url address is: http://10.120.0.115:28080/some.png
the wrong png url address is: http://10.120.0.115/some.png
how can i do when we use another port instead 80?
@Falco @pfaffman
Look forward to hearing from you.

Discourse must be ran on the standard web ports 80/443. If you can’t let Discourse listen in those ports directly, you should configure a reverse proxy to redirect traffic from those ports to Discourse, preferably using a subdomain.

1 Like

Thank you very much!
I also use a reverse proxy Nginx
there are the new problem.

I use the docker run directly.
/usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=8 -e UNICORN_SIDEKIQS=1 -e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET= -e DISCOURSE_DB_HOST=10.201.0.116 -e DISCOURSE_DB_PORT=5432 -e LC_ALL=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e DISCOURSE_HOSTNAME=10.201.0.115 -e DISCOURSE_DEVELOPER_EMAILS=sheoixoet@gmail.com -e DISCOURSE_SMTP_ADDRESS=smtp.gmail.com -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=sheoixoet -e DISCOURSE_SMTP_PASSWORD=wpjedgfoiibrbffe -e DISCOURSE_SMTP_ENABLE_START_TLS=true -e DISCOURSE_SMTP_AUTHENTICATION=login -e DISCOURSE_SMTP_OPENSSL_VERIFY_MODE=none -e DISCOURSE_DB_NAME=discourse -e DISCOURSE_DB_USERNAME=postgres -e DISCOURSE_DB_PASSWORD=wetrwet@26 -h wetwrigp93-app --name app -t -p 28080:80 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 02:3a:0a:b4:ce:e9 --privileged local_discourse/app /sbin/boot

the problem is:
the browser status is blocked(csp)?
what can I do?
thanks.

@Falco @pfaffman
I have solve the csp problem.
but there are an new one:
I have change the default port 80 to 28080
but the png address is not take the the new port,
http://10.202.63.38/uploads/default/original/1X/3f10e1453ee931ddb6a9f5ab59d9e4578959fc33.jpeg
it’s a wrong adrress.
the correct one must be:
http://10.202.63.38:28080/uploads/default/original/1X/3f10e1453ee931ddb6a9f5ab59d9e4578959fc33.jpeg
how can I let the web take the new port?
Thanks!

I’ll be happy to help. Please see Discourse Support — Literate Computing, LLC

But I’m pretty sure you’ve already been told that you can’t use a non standard port.

Thanks a lot!
as you say, we must use 80 port, that’s what we’ll have to do.

1 Like

Again, you need a domain, even if that domain is pointing at 10.202.63.38. I’m sure Jay can help get that set up; you’ll probably have to talk to corporate IT :slight_smile:

1 Like