Nginx plugin SNI Hostname Mapping

Started by pheinrich, January 02, 2022, 02:01:12 PM

Previous topic - Next topic
January 02, 2022, 02:01:12 PM Last Edit: January 02, 2022, 02:05:32 PM by pheinrich
Hi,

I need to write a SNI Hostname Mapping containing a regex for my nginx stream config.


     # upstream maps
     map $ssl_preread_server_name $hostmap810accf68e0940739a1a2e6e120da638 {
         ~(.*).xxx.example.com upstream648aa196e04c4ad89c034af56d947d20;
         default upstream99238aa963f043548157e74820e3cb70;

     }


But for some reason the UI does not allow to insert something thats not a hostname.
If I change this manually in /usr/local/etc/nginx/nginx.conf and restart all is ok, so it's supported by nginx.

I searched around and tried to find whats going on here $nginx->serializeToConfig(); but I have no glue where the hostname validation is applied.

The Nginx SettingsController.php extends ApiMutableModelControllerBase but where is the assumption that hostname inside the sni_mapping_table should be a valid hostname?

https://github.com/opnsense/plugins/issues/2733


Thank you! All working now. Have created a pull request to change that type.