mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
Finally fix firstboot redirect problems.
This issue was easy to solve once I started using the Live HTTP Headers Firefox extension to debug it: https://addons.mozilla.org/en-US/firefox/addon/live-http-headers/ With this particular InternalRedirect, CherryPy inexplicably responds with a 301 ("Moved Permanently") unless we manually tell it to use a 307 ("Moved Temporarily") response code. I don't know why CherryPy does this, and it may be indicative of a deeper problem that I don't currently have time to debug, as the request-response process for redirecting from http://(server)/plinth to https://(server)/plinth/firstboot is ridiculous and contains about twice as many requests as I would've expected.
This commit is contained in:
parent
4d5d93678b
commit
68e186deff
@ -60,7 +60,10 @@ class Root(plugin_mount.PagePlugin):
|
||||
# if we created a new user db, make sure it can't be read by everyone
|
||||
userdb_fname = '{}.sqlite3'.format(cfg.user_db)
|
||||
os.chmod(userdb_fname, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP)
|
||||
raise cherrypy.InternalRedirect('firstboot')
|
||||
# cherrypy.InternalRedirect throws a 301, causing the
|
||||
# browser to cache the redirect, preventing the user from
|
||||
# navigating to /plinth until the browser is restarted.
|
||||
raise cherrypy.HTTPRedirect('firstboot', 307)
|
||||
elif db['state'] < 5:
|
||||
cfg.log("First Boot state = %d" % db['state'])
|
||||
raise cherrypy.InternalRedirect('firstboot/state%d' % db['state'])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user