diff --git a/reverse-proxy/conf.d.dev/default.conf b/reverse-proxy/conf.d.dev/default.conf
index 84922ade6..4eac76ef5 100644
--- a/reverse-proxy/conf.d.dev/default.conf
+++ b/reverse-proxy/conf.d.dev/default.conf
@@ -1,8 +1,7 @@
server {
listen 80 default_server;
- location ^~ /api/ {
- rewrite ^/api/(.*)$ /$1 break;
+ location /api/directory {
proxy_pass http://directory-api:80;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
@@ -12,4 +11,15 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
+
+ location /api {
+ proxy_pass http://api-docs:8080;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection keep-alive;
+ proxy_set_header Host $host;
+ proxy_cache_bypass $http_upgrade;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ }
}
\ No newline at end of file
diff --git a/reverse-proxy/conf.d/default.conf b/reverse-proxy/conf.d/default.conf
index db17d3e65..4b3cb0532 100644
--- a/reverse-proxy/conf.d/default.conf
+++ b/reverse-proxy/conf.d/default.conf
@@ -8,9 +8,8 @@ server {
ssl_certificate_key /etc/nginx/cert/filterlists_key.pem;
add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; img-src 'self' data:; manifest-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-ancestors 'none';" always;
-
- location ^~ /api/ {
- rewrite ^/api/(.*)$ /$1 break;
+
+ location /api/directory {
proxy_pass http://directory-api:80;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
@@ -21,6 +20,17 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
+ location /api {
+ proxy_pass http://api-docs:8080;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection keep-alive;
+ proxy_set_header Host $host;
+ proxy_cache_bypass $http_upgrade;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ }
+
location / {
proxy_pass http://web:80;
proxy_http_version 1.1;
diff --git a/services/Directory/FilterLists.Directory.Api/FilterLists.Directory.Api.csproj b/services/Directory/FilterLists.Directory.Api/FilterLists.Directory.Api.csproj
index 80cd80c94..1d8ede3c4 100644
--- a/services/Directory/FilterLists.Directory.Api/FilterLists.Directory.Api.csproj
+++ b/services/Directory/FilterLists.Directory.Api/FilterLists.Directory.Api.csproj
@@ -28,7 +28,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/services/Directory/FilterLists.Directory.Api/Startup.cs b/services/Directory/FilterLists.Directory.Api/Startup.cs
index 5d59baea2..741f561cc 100644
--- a/services/Directory/FilterLists.Directory.Api/Startup.cs
+++ b/services/Directory/FilterLists.Directory.Api/Startup.cs
@@ -1,4 +1,4 @@
-using FilterLists.Directory.Application;
+using FilterLists.Directory.Application;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
@@ -22,7 +22,7 @@ public void ConfigureServices(IServiceCollection services)
services.AddRouting(o => o.LowercaseUrls = true);
services.AddControllers()
.AddJsonOptions(o => o.JsonSerializerOptions.IgnoreNullValues = true);
- services.AddSwaggerGen(o => o.CustomSchemaIds(type => type.ToString()));
+ services.AddSwaggerGen();
services.AddApplicationServices(Configuration);
}
diff --git a/services/Directory/FilterLists.Directory.Api/SwaggerExtensions.cs b/services/Directory/FilterLists.Directory.Api/SwaggerExtensions.cs
index 76d30d0f3..2a9929374 100644
--- a/services/Directory/FilterLists.Directory.Api/SwaggerExtensions.cs
+++ b/services/Directory/FilterLists.Directory.Api/SwaggerExtensions.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
@@ -11,6 +11,7 @@ internal static class SwaggerExtensions
public static void AddSwaggerGen(this IServiceCollection services)
{
services.AddSwaggerGen(o =>
+ {
o.SwaggerDoc("v1", new OpenApiInfo
{
Title = "FilterLists Directory API",
@@ -24,7 +25,9 @@ public static void AddSwaggerGen(this IServiceCollection services)
Name = "MIT License",
Url = new Uri("https://github.com/collinbarrett/FilterLists/blob/master/LICENSE")
}
- }));
+ });
+ o.CustomSchemaIds(type => type.ToString());
+ });
}
public static void UseSwagger(this IApplicationBuilder app)
@@ -41,13 +44,6 @@ public static void UseSwagger(this IApplicationBuilder app)
#endif
});
});
- app.UseSwaggerUI(o =>
- {
- o.SwaggerEndpoint("v1/swagger.json", "FilterLists Directory API V1");
- o.DocumentTitle = "FilterLists Directory API";
- o.RoutePrefix = string.Empty;
- o.EnableDeepLinking();
- });
}
}
}
diff --git a/web/src/hooks/useLanguages.tsx b/web/src/hooks/useLanguages.tsx
index 3616fc4c8..5d529eb74 100644
--- a/web/src/hooks/useLanguages.tsx
+++ b/web/src/hooks/useLanguages.tsx
@@ -3,5 +3,5 @@ import { useApiData } from "./useApiData";
export const useLanguages = () =>
(
- useApiData("/api/languages") || []
+ useApiData("/api/directory/languages") || []
).sort((a: Language, b: Language) => a.name.localeCompare(b.name));
diff --git a/web/src/hooks/useLicenses.tsx b/web/src/hooks/useLicenses.tsx
index 79b881229..2577ccd09 100644
--- a/web/src/hooks/useLicenses.tsx
+++ b/web/src/hooks/useLicenses.tsx
@@ -3,5 +3,5 @@ import { useApiData } from "./useApiData";
export const useLicenses = () =>
(
- useApiData("/api/licenses") || []
+ useApiData("/api/directory/licenses") || []
).sort((a: License, b: License) => a.name.localeCompare(b.name));
diff --git a/web/src/hooks/useListDetails.tsx b/web/src/hooks/useListDetails.tsx
index e91552944..26be8cd14 100644
--- a/web/src/hooks/useListDetails.tsx
+++ b/web/src/hooks/useListDetails.tsx
@@ -2,5 +2,5 @@ import { ListDetails } from "../interfaces/ListDetails";
import { useApiData } from "./useApiData";
export const useListDetails = (id: number) => {
- return useApiData("/api/lists/" + id);
+ return useApiData("/api/directory/lists/" + id);
};
diff --git a/web/src/hooks/useLists.tsx b/web/src/hooks/useLists.tsx
index 3197679d4..c429b4429 100644
--- a/web/src/hooks/useLists.tsx
+++ b/web/src/hooks/useLists.tsx
@@ -5,7 +5,7 @@ import { List } from "../interfaces/List";
import { useApiData } from "./useApiData";
export const useLists = () => {
- const lists = useApiData("/api/lists");
+ const lists = useApiData("/api/directory/lists");
lists && lists.forEach((l) => (l.slug = slugify(l.name, SlugifyOptions)));
return (lists || []).sort((a: List, b: List) => a.name.localeCompare(b.name));
};
diff --git a/web/src/hooks/useMaintainers.tsx b/web/src/hooks/useMaintainers.tsx
index 5909c9432..eccffaa90 100644
--- a/web/src/hooks/useMaintainers.tsx
+++ b/web/src/hooks/useMaintainers.tsx
@@ -3,5 +3,5 @@ import { useApiData } from "./useApiData";
export const useMaintainers = () =>
(
- useApiData("/api/maintainers") || []
+ useApiData("/api/directory/maintainers") || []
).sort((a: Maintainer, b: Maintainer) => a.name.localeCompare(b.name));
diff --git a/web/src/hooks/useSoftware.tsx b/web/src/hooks/useSoftware.tsx
index b6522f9c2..c94a0a2b2 100644
--- a/web/src/hooks/useSoftware.tsx
+++ b/web/src/hooks/useSoftware.tsx
@@ -3,5 +3,5 @@ import { useApiData } from "./useApiData";
export const useSoftware = () =>
(
- useApiData("/api/software") || []
+ useApiData("/api/directory/software") || []
).sort((a: Software, b: Software) => a.name.localeCompare(b.name));
diff --git a/web/src/hooks/useSyntaxes.tsx b/web/src/hooks/useSyntaxes.tsx
index 2a5615688..3c6ee609f 100644
--- a/web/src/hooks/useSyntaxes.tsx
+++ b/web/src/hooks/useSyntaxes.tsx
@@ -2,6 +2,6 @@ import { Syntax } from "../interfaces/Syntax";
import { useApiData } from "./useApiData";
export const useSyntaxes = () =>
- (useApiData("/api/syntaxes") || []).sort((a: Syntax, b: Syntax) =>
+ (useApiData("/api/directory/syntaxes") || []).sort((a: Syntax, b: Syntax) =>
a.name.localeCompare(b.name)
);
diff --git a/web/src/hooks/useTags.tsx b/web/src/hooks/useTags.tsx
index d062b18bf..301d85ead 100644
--- a/web/src/hooks/useTags.tsx
+++ b/web/src/hooks/useTags.tsx
@@ -2,6 +2,6 @@ import { Tag } from "../interfaces/Tag";
import { useApiData } from "./useApiData";
export const useTags = () =>
- (useApiData("/api/tags") || []).sort((a: Tag, b: Tag) =>
+ (useApiData("/api/directory/tags") || []).sort((a: Tag, b: Tag) =>
a.name.localeCompare(b.name)
);