-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #667 from Health-Informatics-UoN/feat/649/django-r…
…evproxy Add Django proxy for Nextjs
- Loading branch information
Showing
17 changed files
with
96 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
import os | ||
|
||
from django.contrib import admin | ||
from django.urls import path, include | ||
from django.urls import include, path | ||
|
||
urlpatterns = [ | ||
( | ||
path("", include("proxy.urls")) | ||
if os.environ.get("ENABLE_PROXY", "False").lower() == "true" | ||
else None | ||
), | ||
path("", include("mapping.urls")), | ||
path("admin/", admin.site.urls), | ||
path("accounts/", include("django.contrib.auth.urls")), | ||
] | ||
|
||
urlpatterns = [url for url in urlpatterns if url is not None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ProxyConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "proxy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from api import settings | ||
from django.urls import re_path | ||
from revproxy.views import ProxyView | ||
|
||
# A set of urls that will override any root paths requested, and proxy them to the Next.js app. | ||
urlpatterns = [ | ||
re_path( | ||
"scanreports/?(?P<path>.*)$", | ||
ProxyView.as_view(upstream=f"{settings.NEXTJS_URL}/scanreports"), | ||
name="scan-report-list", | ||
), | ||
re_path( | ||
"_next/(?P<path>.*)$", | ||
ProxyView.as_view(upstream=f"{settings.NEXTJS_URL}/_next"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "0.0.1", | ||
"configurations": [ | ||
{ | ||
"name": "Next.js: debug", | ||
"type": "node-terminal", | ||
"request": "launch", | ||
"command": "npm run dev", | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters