prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Error 404 not found when opening admin after upgrade 1.8 to master
  ## Before you open your issue
  - [X] Check if no issue or pull-request for this already exists.
  - [X] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page)
  - [X] You understand `Mailu` is made by volunteers in their **free time** — be conscise, civil and accept that delays can occur.
  - [X] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title.
  
  ## Environment & Versions
  ### Environment
   - [X] docker-compose
  
  ### Versions
  
  Before upgrade: Docker 1.8 images.
  After upgrade: Docker master images (pulled 30 December 2021).
  
  ## Description
  
  **Mailu 1.8** image redirects `/admin` to `/admin/ui`.
  
  **Mailu master** image no longer redirects `/admin/ui` as the `ui` part in the URL has been removed according to [Tomcat 1929.enhacement](https://github.com/Mailu/Mailu/blob/master/towncrier/newsfragments/1929.enhancement):
  
  > Removed the /admin/ prefix to reduce complexity of routing with Mailu. Admin is accessible directly via /admin instead of /admin/ui
  
  After the upgrade from `1.8` to `master` and visiting the admin page, the browser still uses the cached URL `/admin/ui` and results in 404 not found.
  
  
  ## Replication Steps
  
  1. Create 1.8 production environment on AMD64 platform using `mailu 1.8 Docker images`.
  2. Make sure the Admin page works.
  3. Remove docker containers (`docker-compose down`).
  4. Recreate **all** containers at the same time using `mailu master Docker images`.
  5. Open root mail domain. The browser uses the cached URL `admin/ui` and shows Error 404 not found.
  
  Note:  Tested with `TLS_FLAVOR=letsencrypt`, admin and roundcube and Firefox.
  
  
  ## Expected behaviour
  
  Backwards compatibility after Mailu 1.8 upgrade without the need of removing browser caches.
  
  ## Front log
  
  ```
  front_1     | <IP> - - [30/Dec/2021:10:14:35 +0000] "GET /admin/ui/ HTTP/2.0" 404 198 "https://mail.mydomain.nl/sso/login" "Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0"
  ```
  
  ## Bugfix
  
  Proposal is to redirect `/admin/ui` always to `/admin` to prevent browser caching problems after the upgrade.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `core/admin/mailu/ui/views/base.py`
  Content:
  ```
  1 from mailu import models, utils
  2 from mailu.ui import ui, forms, access
  3 
  4 from flask import current_app as app
  5 import flask
  6 import flask_login
  7 
  8 
  9 @ui.route('/', methods=["GET"])
  10 @access.authenticated
  11 def index():
  12     return flask.redirect(flask.url_for('.user_settings'))
  13 
  14 @ui.route('/announcement', methods=['GET', 'POST'])
  15 @access.global_admin
  16 def announcement():
  17     form = forms.AnnouncementForm()
  18     if form.validate_on_submit():
  19         for user in models.User.query.all():
  20             user.sendmail(form.announcement_subject.data,
  21                 form.announcement_body.data)
  22         # Force-empty the form
  23         form.announcement_subject.data = ''
  24         form.announcement_body.data = ''
  25         flask.flash('Your announcement was sent', 'success')
  26     return flask.render_template('announcement.html', form=form)
  27 
  28 @ui.route('/webmail', methods=['GET'])
  29 def webmail():
  30     return flask.redirect(app.config['WEB_WEBMAIL'])
  31 
  32 @ui.route('/client', methods=['GET'])
  33 def client():
  34     return flask.render_template('client.html')
  35 
  36 @ui.route('/webui_antispam', methods=['GET'])
  37 def antispam():
  38     return flask.render_template('antispam.html')
  39
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/core/admin/mailu/ui/views/base.py b/core/admin/mailu/ui/views/base.py
  --- a/core/admin/mailu/ui/views/base.py
  +++ b/core/admin/mailu/ui/views/base.py
  @@ -11,6 +11,10 @@
   def index():
       return flask.redirect(flask.url_for('.user_settings'))
   
  +@ui.route('/ui/')
  +def redirect_old_path():
  +    return flask.redirect(flask.url_for('.index'), code=301)
  +
   @ui.route('/announcement', methods=['GET', 'POST'])
   @access.global_admin
   def announcement():
  
verification_info: {"golden_diff": "diff --git a/core/admin/mailu/ui/views/base.py b/core/admin/mailu/ui/views/base.py\n--- a/core/admin/mailu/ui/views/base.py\n+++ b/core/admin/mailu/ui/views/base.py\n@@ -11,6 +11,10 @@\n def index():\n     return flask.redirect(flask.url_for('.user_settings'))\n \n+@ui.route('/ui/')\n+def redirect_old_path():\n+    return flask.redirect(flask.url_for('.index'), code=301)\n+\n @ui.route('/announcement', methods=['GET', 'POST'])\n @access.global_admin\n def announcement():\n", "issue": "Error 404 not found when opening admin after upgrade 1.8 to master\n## Before you open your issue\r\n- [X] Check if no issue or pull-request for this already exists.\r\n- [X] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page)\r\n- [X] You understand `Mailu` is made by volunteers in their **free time** \u2014 be conscise, civil and accept that delays can occur.\r\n- [X] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title.\r\n\r\n## Environment & Versions\r\n### Environment\r\n - [X] docker-compose\r\n\r\n### Versions\r\n\r\nBefore upgrade: Docker 1.8 images.\r\nAfter upgrade: Docker master images (pulled 30 December 2021).\r\n\r\n## Description\r\n\r\n**Mailu 1.8** image redirects `/admin` to `/admin/ui`.\r\n\r\n**Mailu master** image no longer redirects `/admin/ui` as the `ui` part in the URL has been removed according to [Tomcat 1929.enhacement](https://github.com/Mailu/Mailu/blob/master/towncrier/newsfragments/1929.enhancement):\r\n\r\n> Removed the /admin/ prefix to reduce complexity of routing with Mailu. Admin is accessible directly via /admin instead of /admin/ui\r\n\r\nAfter the upgrade from `1.8` to `master` and visiting the admin page, the browser still uses the cached URL `/admin/ui` and results in 404 not found.\r\n\r\n\r\n## Replication Steps\r\n\r\n1. Create 1.8 production environment on AMD64 platform using `mailu 1.8 Docker images`.\r\n2. Make sure the Admin page works.\r\n3. Remove docker containers (`docker-compose down`).\r\n4. Recreate **all** containers at the same time using `mailu master Docker images`.\r\n5. Open root mail domain. The browser uses the cached URL `admin/ui` and shows Error 404 not found.\r\n\r\nNote:  Tested with `TLS_FLAVOR=letsencrypt`, admin and roundcube and Firefox.\r\n\r\n\r\n## Expected behaviour\r\n\r\nBackwards compatibility after Mailu 1.8 upgrade without the need of removing browser caches.\r\n\r\n## Front log\r\n\r\n```\r\nfront_1     | <IP> - - [30/Dec/2021:10:14:35 +0000] \"GET /admin/ui/ HTTP/2.0\" 404 198 \"https://mail.mydomain.nl/sso/login\" \"Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0\"\r\n```\r\n\r\n## Bugfix\r\n\r\nProposal is to redirect `/admin/ui` always to `/admin` to prevent browser caching problems after the upgrade.\n", "before_files": [{"content": "from mailu import models, utils\nfrom mailu.ui import ui, forms, access\n\nfrom flask import current_app as app\nimport flask\nimport flask_login\n\n\n@ui.route('/', methods=[\"GET\"])\n@access.authenticated\ndef index():\n    return flask.redirect(flask.url_for('.user_settings'))\n\n@ui.route('/announcement', methods=['GET', 'POST'])\n@access.global_admin\ndef announcement():\n    form = forms.AnnouncementForm()\n    if form.validate_on_submit():\n        for user in models.User.query.all():\n            user.sendmail(form.announcement_subject.data,\n                form.announcement_body.data)\n        # Force-empty the form\n        form.announcement_subject.data = ''\n        form.announcement_body.data = ''\n        flask.flash('Your announcement was sent', 'success')\n    return flask.render_template('announcement.html', form=form)\n\n@ui.route('/webmail', methods=['GET'])\ndef webmail():\n    return flask.redirect(app.config['WEB_WEBMAIL'])\n\n@ui.route('/client', methods=['GET'])\ndef client():\n    return flask.render_template('client.html')\n\n@ui.route('/webui_antispam', methods=['GET'])\ndef antispam():\n    return flask.render_template('antispam.html')\n", "path": "core/admin/mailu/ui/views/base.py"}], "after_files": [{"content": "from mailu import models, utils\nfrom mailu.ui import ui, forms, access\n\nfrom flask import current_app as app\nimport flask\nimport flask_login\n\n\n@ui.route('/', methods=[\"GET\"])\n@access.authenticated\ndef index():\n    return flask.redirect(flask.url_for('.user_settings'))\n\n@ui.route('/ui/')\ndef redirect_old_path():\n    return flask.redirect(flask.url_for('.index'), code=301)\n\n@ui.route('/announcement', methods=['GET', 'POST'])\n@access.global_admin\ndef announcement():\n    form = forms.AnnouncementForm()\n    if form.validate_on_submit():\n        for user in models.User.query.all():\n            user.sendmail(form.announcement_subject.data,\n                form.announcement_body.data)\n        # Force-empty the form\n        form.announcement_subject.data = ''\n        form.announcement_body.data = ''\n        flask.flash('Your announcement was sent', 'success')\n    return flask.render_template('announcement.html', form=form)\n\n@ui.route('/webmail', methods=['GET'])\ndef webmail():\n    return flask.redirect(app.config['WEB_WEBMAIL'])\n\n@ui.route('/client', methods=['GET'])\ndef client():\n    return flask.render_template('client.html')\n\n@ui.route('/webui_antispam', methods=['GET'])\ndef antispam():\n    return flask.render_template('antispam.html')\n", "path": "core/admin/mailu/ui/views/base.py"}]}