Generate https links in port 80

I need to implement the server so that it listens to port 80 but gives links in https. How can I solve this problem?

my configuration now works like this and all the links are in http:
expose:
# - “443:443” # https
- “80:80” # https

I try rename in 443 but fail.

I don’t think that would be possible to do.

1 Like

LetsEncrypt is quite strict and so I do not think they will provide SSL certs for any port other than 443, for security reasons.

2 Likes

Maybe turn on the force https site setting?

1 Like

Could you explain why you need to do this?

1 Like

There is an internal server on which Dicsoure stands and is open for listening on port 80, when a visitor asks for a site, it always opens in https (redirects), but all the links are in http. I do not control this infrastructure, but besides port 80 I have no way out

I’m afraid in my case this will not work because I do not work with https actually

I can turn it off, but it seems to me that this will not solve the problem, since enabling HTTPS on port 80 is impossible because of the SSL

Discourse doesn’t support running on non-standard ports.

That includes running https on port 80.

1 Like

Do you mean that you have a reverse proxy setup elsewhere that is handling SSL for all your sites, including Discourse?

1 Like

Did you try it?

Then what are you trying to do?

Doesn’t that mean that you want links on pages that are served to be https and that you are handling https some other way?

Sorry, I’m not following (fully understanding) your posts.

You said,

I need to implement the server so that it listens to port 80 but gives links in https. How can I solve this problem?

If I understand you directly, you want all port 80 HTTP traffic to redirect to port 443 HTTPS and you do not want to send HTTPS traffic on port 80, but only redirect port 80 to port 443.

If so, this is how most every web server is set up; and for example, if you use LetsEncrypt to set up your port 443 traffic using Apache2 or ngnix, LetsEncrypt will ask you if you want to set up this redirect and will do it for you.

As @Falco asked, what is your exact configuration? Are you running a web server like nginx or Apache2 in front of Discourse as a reverse proxy?

If so, when you set up LetsEncrypt on nginx or Apache2, the LetsEncrypt setup software will set up the “redirect all HTTP to HTTPS” for you (if you select “yes” when the configuration dialog asks).

2 Likes

Yes, they understood me correctly
Screenshot_1
I can no longer open any other ports, and there is a reverse proxy that makes the site https but not links in the inside Discourse

Hmm, my output stream from Discourse is always 80. I can’t listen to other ports, and there’s no LetsEcrypt about it.

Hi @anton21m

Yes, so we new understand more clearly you have a reverse proxy in front of your container.

What is the reverse proxy you are using, nginx? Apache2?

server: nginx/1.14.1
But I do not have access to it

You can that all links are http

That’s a nice, clean looking new Discourse site @anton21m

We all understand completely your situation now. Thanks.

If you don’t have access to nginx or the system; then you need to ask your system admin to install LetsEncrypt and add SSL to your site.

That’s really your only option if you are going to stick with that hosting provider and you do not have access to nginx.

Sorry to inform you. Maybe consider another hosting provider?

1 Like

Clearly, then this is impossible !!!
I would like to find a solution like this

That “desired solution” you are talking about is exactly what we advised you to do; e.g. set up your web server to redirect port 80 traffic to port 443.

and that solution requires you to modify the web server, the same as you have been advised.

So, @anton21m, we are beginning to go around in circles…

But let me repeat it again, just for you @anton21m :slight_smile: :slight_smile: because we want you to succeed!

You need access to the web server and have it set up where the port 80 traffic is redirected to port 443 and you need to set up the SSL certs in the same web server. If your hosting provider does not permit this, then you need to move to another hosting provider.

You might consider hosting it with one of the Discourse recommended hosting providers, because they will do all this for you easily.

Hope this helps.

Recommended:

https://www.communiteq.com/

1 Like

You should be able to achieve that by enabling force_https site setting of Discourse.

3 Likes