Skip to content
Snippets Groups Projects
Commit ad971e95 authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Bastien Abadie
Browse files

Do not serve the frontend for unknown API URLs

parent 51693d1a
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