feat: update example compose, change default redirect
This commit is contained in:
parent
d92edafb03
commit
d664899ab6
@ -6,6 +6,8 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
network: 'host'
|
network: 'host'
|
||||||
|
environment:
|
||||||
|
- APP_URL=https://domain.com
|
||||||
ports:
|
ports:
|
||||||
- '80:8080'
|
- '80:8080'
|
||||||
restart: 'always'
|
restart: 'always'
|
@ -28,11 +28,11 @@ func ChangeOptions(c *gin.Context) {
|
|||||||
// get redirect url from query
|
// get redirect url from query
|
||||||
redirectUrl := c.Query("redirect_url")
|
redirectUrl := c.Query("redirect_url")
|
||||||
if redirectUrl == "" {
|
if redirectUrl == "" {
|
||||||
redirectUrl = "/"
|
redirectUrl = os.Getenv("APP_URL")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !strings.HasPrefix(redirectUrl, os.Getenv("APP_URL")) {
|
if !strings.HasPrefix(redirectUrl, os.Getenv("APP_URL")) {
|
||||||
redirectUrl = "/"
|
redirectUrl = os.Getenv("APP_URL")
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Redirect(302, redirectUrl)
|
c.Redirect(302, redirectUrl)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user