Skip to content

Commit

Permalink
fix: update Docker run command and add hostname validation in reverse…
Browse files Browse the repository at this point in the history
… proxy middleware
  • Loading branch information
Alokskj committed Jan 9, 2025
1 parent 1210bce commit a9ec226
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ jobs:
sudo docker pull alokskj/instahost:latest
sudo docker stop instahost
sudo docker rm instahost
sudo docker run -d --env-file ./.env -p 5000:80 --name instahost alokskj/instahost
sudo docker run -d --env-file ./.env -p 80:80 --name instahost alokskj/instahost
6 changes: 5 additions & 1 deletion src/middlewares/reverseProxy.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ const reverseProxy = async (
// Extract subdomain from the request hostname
const hostname = req.hostname; // e.g. 'evara.com' or 'evara.instahost.com' or 'instahost.com'
console.log(hostname);
if (!hostname) {
res.status(404).send();
return;
}
const host = _config.host; // e.g 'instahost.com'
let domain;
if (hostname.includes(host)) {
if (hostname?.includes(host)) {
if (hostname !== host) {
domain =
hostname.split('.').length > host.split('.').length
Expand Down

0 comments on commit a9ec226

Please sign in to comment.