Hi, I'm sorry for the babble above but there are so many point of failure and the setup is so complex.
Last problem was php (e.g. phpMyAdmin).
Anyway now really works this way:
src/http/ngx_http_header_filter_module.c:
#if (NGX_HTTP_SSL)
if (c->ssl || port == 443) {
*b->last++ ='s';
}
#endif
nginx.conf:
server {
listen 127.0.0.1:443 proxy_protocol;
port_in_redirect on;
stunnel configuration:
[tls]
accept = 192.168.1.31:1443
connect = 127.0.0.1:1080
protocol = proxy
[ssh]
sni = tls:ssh.go.ro
...
[tls to any http]
sni = tls:*
connect = 127.0.0.1:443
protocol = proxy
fastcgi_params:
fastcgi_param HTTPS "on";
fastcgi_param SERVER_PORT "443";
------------------------
https://adrhc.go.ro