# Nginx mail starttls ip based

**URL:** <https://www.ruby-forum.com/t/nginx-mail-starttls-ip-based/225076>\
**Category:** NGINX\
**Created:** [December 11, 2012, 11:47am UTC](https://www.ruby-forum.com/t/nginx-mail-starttls-ip-based/225076 "2012-12-11T11:47:46Z")\
**Posts on this page:** 2\
**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:** [December 11, 2012, 11:47am UTC](https://www.ruby-forum.com/t/nginx-mail-starttls-ip-based/225076/1 "2012-12-11T11:47:46Z")

</div>

Hello,

I’m new in nginx world. I would like to configure a single nginx server  
to proxy imap/pop servers with starttls option.

I would like that the “starttls” could be “on” on a list of known safe  
IPs  
and “only” on other IPs. Using the same listen port and protocol.

Could you tell me how to achieve this?  
Maybe, is there a way to set the starttls in auth phase?

For instance, let suppose I have configured this:

server {  
listen 110;  
protocol pop3;  
starttls on;  
proxy on;  
}

server {  
listen 110;  
protocol pop3;  
starttls only;  
proxy on;  
}

I would select first or second server block using Client-IP header.  
Is it possible?

Thanks a lot.  
Best Regards  
Marco

---

<div class="post-metadata">

**Author:** ![marco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a698b9/32.png) [@marco](https://www.ruby-forum.com/u/marco)\
**Post date:** [December 11, 2012, 1:31pm UTC](https://www.ruby-forum.com/t/nginx-mail-starttls-ip-based/225076/2 "2012-12-11T13:31:48Z")

</div>

Hello!

On Tue, Dec 11, 2012 at 10:14:05AM +0000, Marco wrote:

> ```
> listen 110;
> protocol pop3;
> starttls only;
> proxy on;
> 
> ```
> 
> }
> 
> I would select first or second server block using Client-IP header.  
> Is it possible?

No. Either use “starttls only” for all clients, or configure  
different servers on different ip addresses/ports.

–  
Maxim D.

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.
