# Generate https links in port 80

**URL:** https://meta.discourse.org/t/generate-https-links-in-port-80/153448
**Category:** Self-hosting
**Created:** [June 1, 2020, 9:06am UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448 "2020-06-01T09:06:58Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![anton21m](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anton21m/32/192023_2.png) [@anton21m](https://meta.discourse.org/u/anton21m)
#### Post date: [June 1, 2020, 9:06am UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/1 "2020-06-01T09:06:58Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [June 1, 2020, 9:27am UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/2 "2020-06-01T09:27:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)
#### Post date: [June 1, 2020, 2:20pm UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/3 "2020-06-01T14:20:49Z")

</div>

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

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 1, 2020, 2:26pm UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/4 "2020-06-01T14:26:42Z")

</div>

Maybe turn on the `force https` site setting?

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [June 1, 2020, 3:09pm UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/5 "2020-06-01T15:09:11Z")

</div>

Could you explain why you need to do this?

---

<div class="post-metadata">

### Author: ![anton21m](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anton21m/32/192023_2.png) [@anton21m](https://meta.discourse.org/u/anton21m)
#### Post date: [June 2, 2020, 7:26pm UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/6 "2020-06-02T19:26:18Z")

</div>

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

---

<div class="post-metadata">

### Author: ![anton21m](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anton21m/32/192023_2.png) [@anton21m](https://meta.discourse.org/u/anton21m)
#### Post date: [June 2, 2020, 7:27pm UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/7 "2020-06-02T19:27:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![anton21m](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anton21m/32/192023_2.png) [@anton21m](https://meta.discourse.org/u/anton21m)
#### Post date: [June 2, 2020, 7:29pm UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/8 "2020-06-02T19:29:20Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [June 2, 2020, 7:51pm UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/9 "2020-06-02T19:51:09Z")

</div>

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

That includes running https on port 80.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [June 2, 2020, 7:56pm UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/10 "2020-06-02T19:56:22Z")

</div>

> [@anton21m](#):
>
> I need to implement the server so that it listens to port 80 but gives links in https. How can I solve this problem?

> [@anton21m](#):
>
> 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)

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

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 2, 2020, 10:36pm UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/11 "2020-06-02T22:36:54Z")

</div>

Did you try it?

Then what are you trying to do?

> [@anton21m](#):
>
> I need to implement the server so that it listens to port 80 but gives links in https. How can I solve this problem?

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?

---

<div class="post-metadata">

### Author: ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)
#### Post date: [June 3, 2020, 4:05am UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/12 "2020-06-03T04:05:02Z")

</div>

> [@anton21m](#):
>
> 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

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).

---

<div class="post-metadata">

### Author: ![anton21m](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anton21m/32/192023_2.png) [@anton21m](https://meta.discourse.org/u/anton21m)
#### Post date: [June 3, 2020, 8:02am UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/13 "2020-06-03T08:02:03Z")

</div>

Yes, they understood me correctly

 ![Screenshot_1](https://global.discourse-cdn.com/meta/original/3X/e/4/e46c12df6d88bceabb903abead4ec08977701664.png)  
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

---

<div class="post-metadata">

### Author: ![anton21m](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anton21m/32/192023_2.png) [@anton21m](https://meta.discourse.org/u/anton21m)
#### Post date: [June 3, 2020, 8:04am UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/14 "2020-06-03T08:04:16Z")

</div>

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

---

<div class="post-metadata">

### Author: ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)
#### Post date: [June 3, 2020, 8:13am UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/15 "2020-06-03T08:13:39Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![anton21m](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anton21m/32/192023_2.png) [@anton21m](https://meta.discourse.org/u/anton21m)
#### Post date: [June 3, 2020, 8:15am UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/16 "2020-06-03T08:15:39Z")

</div>

server: nginx/1.14.1  
But I do not have access to it  
[https://forum.qpay.uz/](https://forum.qpay.uz/)

You can that all links are http

---

<div class="post-metadata">

### Author: ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)
#### Post date: [June 3, 2020, 8:22am UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/17 "2020-06-03T08:22:50Z")

</div>

> [@anton21m](#):
>
> server: nginx/1.14.1  
> But I do not have access to it

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?

---

<div class="post-metadata">

### Author: ![anton21m](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anton21m/32/192023_2.png) [@anton21m](https://meta.discourse.org/u/anton21m)
#### Post date: [June 4, 2020, 9:29am UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/18 "2020-06-04T09:29:08Z")

</div>

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

 ![image](https://global.discourse-cdn.com/meta/original/3X/8/9/891140cb0c383bce63099bc56d1c50dacc8319d1.png)

---

<div class="post-metadata">

### Author: ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)
#### Post date: [June 4, 2020, 9:42am UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/19 "2020-06-04T09:42:19Z")

</div>

> [@anton21m](#):
>
> 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.

> **[How to Easily Move WordPress from HTTP to HTTPS (Beginner’s Guide)](https://www.wpbeginner.com/wp-tutorials/how-to-add-ssl-and-https-in-wordpress/)**
>
> Add SSL and switch your WordPress site to HTTPS with our detailed guide. Secure your site, boost SEO, and build user trust with easy-to-follow steps.

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🙂 🙂 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:

> **[Managed Discourse Hosting - Communiteq](https://www.communiteq.com/)**

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [June 4, 2020, 10:13am UTC](https://meta.discourse.org/t/generate-https-links-in-port-80/153448/20 "2020-06-04T10:13:11Z")

</div>

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

[Next page](https://meta.discourse.org/t/generate-https-links-in-port-80/153448.md?page=2)
