remove static route redirects / bump static to top level (#1299)

* add another favicon rule

* catch only top-level dataset names

* add config flag to disable redirects

* remove static redirect, point all links to top-level /static

* remove extraneous argument

* remove httpd redirect
This commit is contained in:
Bruce Martin
2020-03-26 10:45:10 -07:00
committed by GitHub
parent 40c2e4c164
commit 57938b487b
5 changed files with 56 additions and 57 deletions
+2 -8
View File
@@ -44,7 +44,9 @@ def dataset_index(dataset=None):
)
# TODO: remove the top-level /favicon route once the build problem with index.html is resolved
@webbp.route("/favicon.png", methods=["GET"])
@webbp.route("/static/img/favicon.png", methods=["GET"])
def favicon():
return send_from_directory(os.path.join(webbp.root_path, "static/img/"), "favicon.png")
@@ -89,11 +91,6 @@ def rest_get_data_adaptor(func):
return wrapped_function
def static_redirect(dataset, therest):
""" redirect all static requests to the standard location """
return redirect(f"/static/{therest}", code=301)
def dataroot_test_index():
# the following index page is meant for testing/debugging purposes
data = '<!doctype html><html lang="en">'
@@ -229,9 +226,6 @@ class Server:
resources = get_api_resources(bp_api)
self.app.register_blueprint(resources.blueprint)
self.app.add_url_rule("/d/<dataset>/", "dataset_index", dataset_index, methods=["GET"])
self.app.add_url_rule(
"/d/<dataset>/static/<path:therest>", "static_redirect", static_redirect, methods=["GET"]
)
self.app.matrix_data_cache_manager = matrix_data_cache_manager
self.app.annotations = annotations
@@ -1,11 +0,0 @@
# Configure URL rewriting from /<dataset>/static/* to /static/*
files:
"/etc/httpd/conf.d/static_rewrite.conf":
mode: "000644"
owner: root
group: root
content: |
RewriteEngine On
RewriteRule "^(.*)/static/(.*)" "/static/$2" [PT]
RewriteRule "^/favicon.png" "/static/img/favicon.png" [PT]