# Support for both HTTP and HTTPS requests on port 443

**URL:** <https://www.ruby-forum.com/t/support-for-both-http-and-https-requests-on-port-443/198176>\
**Category:** NGINX\
**Created:** [October 27, 2010, 3:44pm UTC](https://www.ruby-forum.com/t/support-for-both-http-and-https-requests-on-port-443/198176 "2010-10-27T15:44:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [October 27, 2010, 3:44pm UTC](https://www.ruby-forum.com/t/support-for-both-http-and-https-requests-on-port-443/198176/1 "2010-10-27T15:44:23Z")

</div>

Hello,

I have HTTPS/SSL server configured like this:

server {  
listen 1.2.3.4:443 ssl;  
server\_name ssl.dom.tld

```
   ssl on;
   keepalive_timeout 70;

   access_log /var/log/nginx/ssl-access.log;
   error_log /var/log/nginx/ssl-error.log;

   location / {

           proxy_pass https://10.0.0.1;

           proxy_next_upstream error timeout invalid_header http_500 

```

http\_502 http\_503;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For  
$proxy\_add\_x\_forwarded\_for;  
proxy\_redirect off;  
}  
}

Is it possible to forward also _http_ (not https) requests made to port  
443  
to the backend (10.0.0.1) port 443 ?

Yes I know, it doesn’t make any sense basicly, but I have a broken  
application that wants to receive both http and https requests on port  
443.

Is that possible with nginx?

– Pasi

---

<div class="post-metadata">

**Author:** ![SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e8c25b/32.png) [@SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/u/SSPasi_KS_rkkS_inen)\
**Post date:** [October 27, 2010, 3:51pm UTC](https://www.ruby-forum.com/t/support-for-both-http-and-https-requests-on-port-443/198176/2 "2010-10-27T15:51:18Z")

</div>

On Wed, Oct 27, 2010 at 04:42:54PM +0300, Pasi K. wrote:

> ```
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> 
> ```
> 
> Is that possible with nginx?  
> I did not tested this, but you may try:

```
    error_page 497 = @no_https;

    location @no_https {
            proxy_pass https://10.0.0.1;

            proxy_next_upstream error timeout invalid_header 

```

http\_500 http\_502 http\_503;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For  
$proxy\_add\_x\_forwarded\_for;  
proxy\_redirect off;  
}

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e8c25b/32.png) [@SSPasi\_KS\_rkkS\_inen](https://www.ruby-forum.com/u/SSPasi_KS_rkkS_inen)\
**Post date:** [November 2, 2010, 9:54pm UTC](https://www.ruby-forum.com/t/support-for-both-http-and-https-requests-on-port-443/198176/3 "2010-11-02T21:54:41Z")

</div>

On Wed, Oct 27, 2010 at 05:50:10PM +0400, Igor S. wrote:

> > ```
> > ssl on;
> > proxy_set_header Host $host;
> > 
> > ```
> > 
> > application that wants to receive both http and https requests on port 443.  
> > proxy\_next\_upstream error timeout invalid\_header http\_500  
> > http\_502 http\_503;  
> > proxy\_set\_header Host $host;  
> > proxy\_set\_header X-Real-IP $remote\_addr;  
> > proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
> > proxy\_redirect off;  
> > }

Ok, thanks! I’ll try it.

– Pasi
