@@ -266,6 +266,31 @@ func Test_hostConfigurationFileProvider(t *testing.T) {
266266 assert .ErrorAs (t , err , & coreErr )
267267 assert .Equal (t , i18n .K .CoreNginxCfgfilesOptionNotFound , coreErr .Message .Key )
268268 })
269+
270+ t .Run ("replaces http with https when UseHTTPS is true" , func (t * testing.T ) {
271+ integrationID := uuid .New ()
272+ r := & host.Route {
273+ SourcePath : "/api" ,
274+ Integration : & host.RouteIntegrationConfig {
275+ IntegrationID : integrationID ,
276+ OptionID : "opt-1" ,
277+ UseHTTPS : true ,
278+ },
279+ }
280+
281+ ctrl := gomock .NewController (t )
282+ defer ctrl .Finish ()
283+
284+ integrationCmds := integration .NewMockedCommands (ctrl )
285+ integrationCmds .EXPECT ().
286+ GetOptionURL (gomock .Any (), integrationID , "opt-1" ).
287+ Return (new ("http ://1.2.3.4:80"), nil, nil)
288+ provider.integrationCommands = integrationCmds
289+
290+ result , err := provider .buildIntegrationRoute (ctx , r , host.FeatureSet {})
291+ assert .NoError (t , err )
292+ assert .Contains (t , result , "proxy_pass https://1.2.3.4:80;" )
293+ })
269294 })
270295
271296 t .Run ("BuildExecuteCodeRoute" , func (t * testing.T ) {
@@ -407,6 +432,52 @@ func Test_hostConfigurationFileProvider(t *testing.T) {
407432 fmt .Sprintf ("include \" /etc/nginx/access-list-%s.conf\" ;" , id ),
408433 )
409434 })
435+
436+ t .Run (
437+ "includes proxy_ssl_server_name on when ProxySSLServerName is true" ,
438+ func (t * testing.T ) {
439+ r := & host.Route {
440+ Settings : host.RouteSettings {
441+ ProxySSLServerName : true ,
442+ },
443+ }
444+ result := provider .buildRouteSettings (ctx , r )
445+ assert .Contains (t , result , "proxy_ssl_server_name on;" )
446+ },
447+ )
448+
449+ t .Run (
450+ "doesn't includes proxy_ssl_server_name when ProxySSLServerName is false" ,
451+ func (t * testing.T ) {
452+ r := & host.Route {
453+ Settings : host.RouteSettings {
454+ ProxySSLServerName : false ,
455+ },
456+ }
457+ result := provider .buildRouteSettings (ctx , r )
458+ assert .NotContains (t , result , "proxy_ssl_server_name" )
459+ },
460+ )
461+
462+ t .Run ("includes proxy_ssl_verify off when IgnoreSSLErrors is true" , func (t * testing.T ) {
463+ r := & host.Route {
464+ Settings : host.RouteSettings {
465+ IgnoreSSLErrors : true ,
466+ },
467+ }
468+ result := provider .buildRouteSettings (ctx , r )
469+ assert .Contains (t , result , "proxy_ssl_verify off;" )
470+ })
471+
472+ t .Run ("does not include proxy_ssl_verify by default" , func (t * testing.T ) {
473+ r := & host.Route {
474+ Settings : host.RouteSettings {
475+ IgnoreSSLErrors : false ,
476+ },
477+ }
478+ result := provider .buildRouteSettings (ctx , r )
479+ assert .NotContains (t , result , "proxy_ssl_verify" )
480+ })
410481 })
411482
412483 t .Run ("BuildBinding" , func (t * testing.T ) {
0 commit comments