@@ -275,11 +275,34 @@ func getHttpServer(fingerprint string, acceptAnonymousUploads bool, assetsDir st
275
275
}
276
276
277
277
appIcon := template .URL (app .Spec .Icon )
278
- htmlPage := "welcome.html"
279
- if c .Request .URL .Path == "/insecure" {
280
- htmlPage = "insecure.html"
278
+ c .HTML (http .StatusOK , "welcome.html" , gin.H {
279
+ "fingerprintSHA1" : fingerprint ,
280
+ "AppIcon" : appIcon ,
281
+ "AppTitle" : app .Spec .Title ,
282
+ "IsEmbeddedCluster" : isEmbeddedCluster (),
283
+ })
284
+ })
285
+ r .GET ("/tls-warning" , func (c * gin.Context ) {
286
+ if ! acceptAnonymousUploads {
287
+ log .Println ("TLS certs already uploaded, redirecting to https" )
288
+ target := url.URL {
289
+ Scheme : "https" ,
290
+ Host : c .Request .Host ,
291
+ Path : c .Request .URL .Path ,
292
+ RawQuery : c .Request .URL .RawQuery ,
293
+ }
294
+ // Returns StatusFound (302) to avoid browser caching
295
+ c .Redirect (http .StatusFound , target .String ())
296
+ return
297
+ }
298
+
299
+ app , err := kotsadmApplication ()
300
+
301
+ if err != nil {
302
+ log .Printf ("No kotsadm application metadata: %v" , err ) // continue
281
303
}
282
- c .HTML (http .StatusOK , htmlPage , gin.H {
304
+ appIcon := template .URL (app .Spec .Icon )
305
+ c .HTML (http .StatusOK , "tls-warning.html" , gin.H {
283
306
"fingerprintSHA1" : fingerprint ,
284
307
"AppIcon" : appIcon ,
285
308
"AppTitle" : app .Spec .Title ,
0 commit comments