# Using nginx as proxy from http to https

**URL:** <https://www.ruby-forum.com/t/using-nginx-as-proxy-from-http-to-https/223986>\
**Category:** NGINX\
**Created:** [October 25, 2012, 4:17pm UTC](https://www.ruby-forum.com/t/using-nginx-as-proxy-from-http-to-https/223986 "2012-10-25T16:17:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [October 25, 2012, 4:17pm UTC](https://www.ruby-forum.com/t/using-nginx-as-proxy-from-http-to-https/223986/1 "2012-10-25T16:17:29Z")

</div>

Hello,

I’m trying to use nginx as a proxy server that should dispatch HTTP  
requests  
to remote HTTPS server. Here are some configuration details which I’m  
using:

```
    location /test_server {
            proxy_pass

```

[https://testserver.testdomainserver.com:9090/](https://testserver.testdomainserver.com:9090/);  
proxy\_set\_header X-Real-IP $remote\_addr;  
}

The problem is that when I send request to the nginx server I get 505  
error  
from remote server. If I execute the request directly to the remote  
server  
it works as expected. Some additional details that I can provide is that  
the  
remote server is using basic authorization and only accepts requests  
through  
HTTPS.

I also tried to bind server on port 443 with ssl on and certificates  
added,  
but when I try to use it, I get the following error:  
error:14090086:SSL routines:SSL3\_GET\_SERVER\_CERTIFICATE:certificate  
verify  
failed

The configuration steps which I tried are explained in:  
[http://wiki.nginx.org/HttpSslModule](http://wiki.nginx.org/HttpSslModule)

Any idea how can I make it work ?

Posted at Nginx Forum:

> **[using nginx as proxy from http to https](https://forum.nginx.org/read.php?2,232212,232212#msg-232212)**
>
> Hello, I'm trying to use nginx as a proxy server that should dispatch HTTP requests to remote HTTPS server. Here are some configuration details which I'm using: location /test\_server { proxy\_pass https://testserver.testdomainserver.

---

<div class="post-metadata">

**Author:** ![mgenov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/65b543/32.png) [@mgenov](https://www.ruby-forum.com/u/mgenov)\
**Post date:** [October 25, 2012, 6:07pm UTC](https://www.ruby-forum.com/t/using-nginx-as-proxy-from-http-to-https/223986/2 "2012-10-25T18:07:20Z")

</div>

On Thu, Oct 25, 2012 at 10:17:08AM -0400, mgenov wrote:

Hi there,

> ```
> location /test_server {
> proxy_pass
> 
> ```
> 
> [https://testserver.testdomainserver.com:9090/](https://testserver.testdomainserver.com:9090/);  
> proxy\_set\_header X-Real-IP $remote\_addr;  
> }
> 
> The problem is that when I send request to the nginx server I get 505 error  
> from remote server. If I execute the request directly to the remote server  
> it works as expected.

HTTP 505 means HTTP Version Not Supported.

What version do you use when you execute the request directly?

What version does nginx use?

Do you see a different response from

curl -i -k [https://testserver.testdomainserver.com:9090/](https://testserver.testdomainserver.com:9090/)

and

curl -i -k -0 [https://testserver.testdomainserver.com:9090/](https://testserver.testdomainserver.com:9090/)

?

Good luck,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![mgenov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/65b543/32.png) [@mgenov](https://www.ruby-forum.com/u/mgenov)\
**Post date:** [October 25, 2012, 6:20pm UTC](https://www.ruby-forum.com/t/using-nginx-as-proxy-from-http-to-https/223986/3 "2012-10-25T18:20:47Z")

</div>

Actually it returns error 500. Here is the log information from  
access.log

[25/Oct/2012:18:44:10 +0300] “POST /testurl/testservice HTTP/1.1” 500 75  
“-”  
“-”

Here is my version.

nginx -v  
nginx version: nginx/0.7.67

In a few minutes I’ll try with curl and will post the result.

> and
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,232212,232224#msg-232224](http://forum.nginx.org/read.php?2,232212,232224#msg-232224)

---

<div class="post-metadata">

**Author:** ![mgenov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/65b543/32.png) [@mgenov](https://www.ruby-forum.com/u/mgenov)\
**Post date:** [October 29, 2012, 3:58pm UTC](https://www.ruby-forum.com/t/using-nginx-as-proxy-from-http-to-https/223986/4 "2012-10-29T15:58:53Z")

</div>

I’ve update my version to: nginx: nginx version: nginx/1.0.5 and it  
seems  
that the result is similar. Any other ideas ?

## Andre J. Wrote:

> Don’t sure, wether this is the problem …  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,232212,232326#msg-232326](http://forum.nginx.org/read.php?2,232212,232326#msg-232326)

---

<div class="post-metadata">

**Author:** ![mgenov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/65b543/32.png) [@mgenov](https://www.ruby-forum.com/u/mgenov)\
**Post date:** [October 25, 2012, 9:04pm UTC](https://www.ruby-forum.com/t/using-nginx-as-proxy-from-http-to-https/223986/5 "2012-10-25T21:04:24Z")

</div>

2012/10/25 mgenov [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Here is my version.
> 
> nginx -v  
> nginx version: nginx/0.7.67

Your version looks outdated …

> 2012-09-25 nginx-1.2.4 stable version has been released. (See:  
> [http://nginx.org/](http://nginx.org/))

Don’t sure, wether this is the problem …  
Well, this is the oldest announcement I’ve found:

> 2009-12-15 nginx-0.8.30 development version has been released. (See:  
> [nginx news: 2009](http://nginx.org/2009.html))

So your versions seems to be REALLY old!

Regards, Andre
