|
@@ -133,24 +133,24 @@ export async function createResource(
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- if (existingResource.length > 0) {
|
|
|
+ if (proxyPort === 443 || proxyPort === 80) {
|
|
|
return next(
|
|
|
createHttpError(
|
|
|
- HttpCode.CONFLICT,
|
|
|
- "Resource with that protocol and port already exists"
|
|
|
+ HttpCode.BAD_REQUEST,
|
|
|
+ "Port 80 and 443 are reserved for https resources"
|
|
|
)
|
|
|
);
|
|
|
}
|
|
|
- } else {
|
|
|
- if (proxyPort === 443 || proxyPort === 80) {
|
|
|
+
|
|
|
+ if (existingResource.length > 0) {
|
|
|
return next(
|
|
|
createHttpError(
|
|
|
- HttpCode.BAD_REQUEST,
|
|
|
- "Port 80 and 443 are reserved for https resources"
|
|
|
+ HttpCode.CONFLICT,
|
|
|
+ "Resource with that protocol and port already exists"
|
|
|
)
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
+ } else {
|
|
|
// make sure the full domain is unique
|
|
|
const existingResource = await db
|
|
|
.select()
|