Skip to content
Snippets Groups Projects
Commit 149c29af authored by Bastien Abadie's avatar Bastien Abadie
Browse files

Merge branch 'api-404' into 'master'

Do not serve the frontend for unknown API URLs

Closes #806

See merge request !1445
parents 51693d1a ad971e95
No related branches found
No related tags found
1 merge request!1445Do not serve the frontend for unknown API URLs
......@@ -60,5 +60,7 @@ if settings.DEBUG:
# Add index.html using CDN assets
# It's served as a full fallback on 404 to support loading specific frontend urls
# The (?!api/) in the regex makes sure that any URL starting in api/ will not match this regex, so it will cause a 404,
# but everything else redirects to index.html; this avoids getting the frontend as a response to an incorrect API URL.
if settings.CDN_ASSETS_URL is not None:
urlpatterns.append(re_path(r'^.*$', CdnHome.as_view(), name="home"))
urlpatterns.append(re_path(r'^(?!api/).*$', CdnHome.as_view(), name="home"))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment