Celebrating 700K+ Installs Up to 35% OFF! View Details →

[Bug 9.4.3] Multiple Domain in 1 App: Hostname in SNI and Hostname in HTTP Host Header Different

Published 15 days ago

# SafeLine WAF
# ❓ question
# 🐞 bug

Published 15 days ago

profile_photo

Kristian Tanuwijaya

Updated 15 days ago

0

version: 9.4.3
occurrence: random/intermittent
backend/upstream url: apache with https/ssl
error message: Hostname app1.my.domain.com provided via SNI and hostname app2.my.domain.com provided via HTTP are different
image.png
image.png

profile_photo

Carrie

Updated 15 days ago

0

Please separate the two domains into two independent applications, then see if the issue persists.

profile_photo

Kristian Tanuwijaya

Updated 14 days ago

0

so far (about half a day

profile_photo

Kristian Tanuwijaya

Updated 8 days ago

0

I have confirmed that this issue does not happen anymore, but does this bug supposed to be fixed? or is this workaround supposed to be permanent?

profile_photo

Carrie

Updated 8 days ago

0

Not a bug. It's how Nginx connection reuse works. When an established HTTPS connection is reused, a new TLS handshake is not performed, so the SNI does not change to match the Host header of the subsequent request.

profile_photo

Kristian Tanuwijaya

Updated 4 days ago

0

I managed to fix this by manually changing the nginx config in /etc/nginx inside safeline-tengine container by adding

proxy_http_version 1.0;
proxy_set_header Connection "close";
proxy_ssl_session_reuse off;

in ./sites-enabled/ files

profile_photo

Kristian Tanuwijaya

Updated 4 days ago

0

to reproduce the issue, assumming safeline is listening to port 3000, and is running in localhost, run this in terminal:

1curl -s -o /dev/null -w "Req A: %{http_code}\n" --resolve='my-app1.com:443:127.0.0.1' -k https://my-app1.com:3000
2curl -s -o /dev/null -w "Req B: %{http_code}\n" --resolve='my-app2.com:443:127.0.0.1' -k https://my-app2.com:3000
3done```
profile_photo

Kristian Tanuwijaya

Updated 4 days ago

0

is it possible to add those option to safeline per apps config?

profile_photo

Carrie

Updated 4 days ago

0

It is better to add these directives to the Custom Nginx Config in the advanced settings of the application. Configuration added at the underlying level will be lost once a full update is triggered.
image.png

profile_photo

Kristian Tanuwijaya

Updated 4 days ago

0

adding them via "custom nginx config" cannot comment out include proxy_params;, which may errors because there's already proxy_http_version directive in that file

profile_photo

Carrie

Updated 4 days ago

0

Add only the following directives to the custom NGINXconfiguration, then test it:

set $connection_upgrade close;
proxy_ssl_session_reuse off;
[Bug 9.4.3] Multiple Domain in 1 App: Hostname in SNI and Hostname in HTTP Host Header Different | CyberServal | CyberServal