Skip to content

Commit 1418c64

Browse files
committed
refactor favicon http method
1 parent 3f2f1f6 commit 1418c64

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

api_oc.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,14 @@ def validateAccessToken():
136136

137137
# Process favicon.ico requests
138138
class Favicon:
139-
def GET(self):
140-
raise web.seeother("/static/favicon.ico")
139+
def GET(self):
140+
is_https = (
141+
web.ctx.env.get('HTTP_X_FORWARDED_PROTO') == 'https' or
142+
web.ctx.env.get('HTTPS') == 'on' or
143+
web.ctx.env.get('SERVER_PORT') == '443'
144+
)
145+
protocol = 'https' if is_https else 'http'
146+
raise web.seeother(f"{protocol}://{web.ctx.host}/static/favicon.ico")
141147

142148
class RedirectIndex:
143149
def GET(self):

0 commit comments

Comments
 (0)