File tree 2 files changed +18
-1
lines changed
rootfs/etc/nginx/template
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
22
22
"encoding/json"
23
23
"fmt"
24
24
"net"
25
+ "net/url"
25
26
"os"
26
27
"os/exec"
27
28
"strings"
@@ -149,6 +150,7 @@ var (
149
150
"serverConfig" : func (all config.TemplateConfig , server * ingress.Server ) interface {} {
150
151
return struct { First , Second interface {} }{all , server }
151
152
},
153
+ "buildAuthSignURL" : buildAuthSignURL ,
152
154
}
153
155
)
154
156
@@ -502,3 +504,18 @@ func buildNextUpstream(input interface{}) string {
502
504
503
505
return strings .Join (nextUpstreamCodes , " " )
504
506
}
507
+
508
+ func buildAuthSignURL (input interface {}) string {
509
+ s , ok := input .(string )
510
+ if ! ok {
511
+ glog .Errorf ("expected an string type but %T was returned" , input )
512
+ }
513
+
514
+ u , _ := url .Parse (s )
515
+ q := u .Query ()
516
+ if len (q ) == 0 {
517
+ return fmt .Sprintf ("%v?rd=$request_uri" , s )
518
+ }
519
+
520
+ return fmt .Sprintf ("%v&rd=$request_uri" , s )
521
+ }
Original file line number Diff line number Diff line change @@ -585,7 +585,7 @@ stream {
585
585
{{ end }}
586
586
587
587
{{ if not (empty $location.ExternalAuth.SigninURL) }}
588
- error_page 401 = {{ $location.ExternalAuth.SigninURL }}?rd=$request_uri ;
588
+ error_page 401 = {{ buildAuthSignURL $location.ExternalAuth.SigninURL }};
589
589
{{ end }}
590
590
591
591
{{/* if the location contains a rate limit annotation, create one */}}
You can’t perform that action at this time.
0 commit comments