From 3201d068204d5d34ae282ac9638f8a6ebeb431a2 Mon Sep 17 00:00:00 2001 From: UO282476 Date: Tue, 2 May 2023 10:20:03 +0200 Subject: [PATCH] Changed webapp ports --- docker-compose-deploy.yml | 4 ++-- docker-compose.yml | 4 ++-- restapi/api.ts | 2 +- restapi/src/repositories/pods/PodSessionManager.ts | 8 ++++---- webapp/Dockerfile | 2 +- webapp/server.js | 4 ++-- webapp/server.ts | 14 -------------- webapp/src/components/mainPage/LoginForm.tsx | 2 +- webapp/src/components/mainPage/NavBar.tsx | 4 ++-- 9 files changed, 15 insertions(+), 29 deletions(-) delete mode 100644 webapp/server.ts diff --git a/docker-compose-deploy.yml b/docker-compose-deploy.yml index 4d63163..98d0436 100644 --- a/docker-compose-deploy.yml +++ b/docker-compose-deploy.yml @@ -15,7 +15,7 @@ services: - /etc/letsencrypt/live/lomapen1a.cloudns.ph/privkey.pem:/app/certificates/privkey.pem - /etc/letsencrypt/live/lomapen1a.cloudns.ph/fullchain.pem:/app/certificates/fullchain.pem ports: - - "80:80" - - "443:443" + - "3080:3080" + - "3443:3443" depends_on: - restapi diff --git a/docker-compose.yml b/docker-compose.yml index 4f60179..c452c8e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,8 +12,8 @@ services: webapp: build: ./webapp ports: - - "80:80" - - "443:443" + - "3080:3080" + - "3443:3443" depends_on: - restapi prometheus: diff --git a/restapi/api.ts b/restapi/api.ts index 8356785..66d0cbf 100644 --- a/restapi/api.ts +++ b/restapi/api.ts @@ -27,7 +27,7 @@ let host = process.env.host || "localhost"; api.use( cors({ credentials: true, - origin: ["https://" + host + ":443"], + origin: ["https://" + host + ":3443"], allowedHeaders: ["Content-Type", "Authorization"], preflightContinue: true, }) diff --git a/restapi/src/repositories/pods/PodSessionManager.ts b/restapi/src/repositories/pods/PodSessionManager.ts index 0467025..1e22490 100644 --- a/restapi/src/repositories/pods/PodSessionManager.ts +++ b/restapi/src/repositories/pods/PodSessionManager.ts @@ -25,7 +25,7 @@ export class PodSessionManager { Assertion.exists(provider, "A provider must be given."); provider = decodeURIComponent(provider); - let redirect = "https://" + host + ":443/api/login/success"; + let redirect = "https://" + host + ":3443/api/login/success"; const session = new Session(); req.session.solidSessionId = session.info.sessionId; @@ -40,7 +40,7 @@ export class PodSessionManager { }, }); } catch (err) { - res.redirect("https://" + host + ":443/login/fail"); + res.redirect("https://" + host + ":3443/login/fail"); } } @@ -52,12 +52,12 @@ export class PodSessionManager { let solidSession = await getSessionFromStorage(sessionId); await solidSession?.handleIncomingRedirect( - `https://${host}:443${this.handle}${req.url}` + `https://${host}:3443${this.handle}${req.url}` ); await PodManager.permissionManager.setupPod(sessionId); - return res.redirect("https://" + host + ":443/map"); + return res.redirect("https://" + host + ":3443/map"); } public async logout(req: any, res: Response): Promise { diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 689334a..3ee9ff1 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -5,7 +5,7 @@ WORKDIR /app #Install the dependencies RUN npm install -ARG API_URI="https://20.13.141.12:443/api" +ARG API_URI="https://20.13.141.12:5443/api" ENV REACT_APP_API_URI=$API_URI ARG HOST_URI="20.13.141.12" diff --git a/webapp/server.js b/webapp/server.js index 4a8c38e..b8d1f83 100644 --- a/webapp/server.js +++ b/webapp/server.js @@ -4,8 +4,8 @@ const express = require('express'); let expressStaticGzip = require('express-static-gzip'); const path = require('path'); -const portHttp = 80; -const portHttps = 443; +const portHttp = 3080; +const portHttps = 3443; //Load certificates let privateKey = fs.readFileSync("certificates/privkey.pem"); diff --git a/webapp/server.ts b/webapp/server.ts deleted file mode 100644 index 673dcf0..0000000 --- a/webapp/server.ts +++ /dev/null @@ -1,14 +0,0 @@ -import express,{Application} from 'express'; -//for using an import here we need to configure the tsconfig.json -//setting the option module to commonjs - -let app: Application = express() -const port: number = 3000; - -app.use(express.static('build')) - -app.listen(port, ():void => { - console.log('Webapp started on port '+ port); -}).on("error",(error:Error)=>{ - console.error('Error occured: ' + error.message); -}); \ No newline at end of file diff --git a/webapp/src/components/mainPage/LoginForm.tsx b/webapp/src/components/mainPage/LoginForm.tsx index bae4605..daca313 100644 --- a/webapp/src/components/mainPage/LoginForm.tsx +++ b/webapp/src/components/mainPage/LoginForm.tsx @@ -19,7 +19,7 @@ export default function LoginForm(props: LoginFormProps): JSX.Element { const [cookies, setCookie] = useCookies(); const [idp, setIdp] = useState(""); - const [currentUrl, setCurrentUrl] = useState("http://localhost:443/map"); + const [currentUrl, setCurrentUrl] = useState("https://localhost:3443/map"); const [notificationStatus, setNotificationStatus] = useState(false); const [notification, setNotification] = useState({ severity: 'warning', message: '' }); diff --git a/webapp/src/components/mainPage/NavBar.tsx b/webapp/src/components/mainPage/NavBar.tsx index d4047ee..aad3bd0 100644 --- a/webapp/src/components/mainPage/NavBar.tsx +++ b/webapp/src/components/mainPage/NavBar.tsx @@ -54,9 +54,9 @@ function LoggedNavbar(props: LogoutProps) { let host = process.env.host || "localhost"; let url = window.location.href; if (url.includes("https")) { - return "https://" + host + ":443/map" + return "https://" + host + ":3443/map" } else { - return "http://" + host + ":80/map" + return "http://" + host + ":3080/map" } }