Skip to content

Commit 0d2a3ac

Browse files
committed
Fix build, fix error with base URLs
1 parent 7070fde commit 0d2a3ac

File tree

4 files changed

+380
-233
lines changed

4 files changed

+380
-233
lines changed

.circleci/config.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/docker.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Docker Build and Push
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
9+
env:
10+
REGISTRY: docker.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Log in to Docker Hub
28+
if: github.event_name != 'pull_request'
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ secrets.DOCKER_USER }}
33+
password: ${{ secrets.DOCKER_PASS }}
34+
35+
- name: Extract metadata (tags, labels) for Docker
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
tags: |
41+
type=ref,event=branch
42+
type=ref,event=pr
43+
type=sha,prefix={{branch}}-
44+
type=raw,value=latest,enable={{is_default_branch}}
45+
46+
- name: Build and push Docker image
47+
uses: docker/build-push-action@v5
48+
with:
49+
context: .
50+
platforms: linux/amd64,linux/arm64
51+
push: ${{ github.event_name != 'pull_request' }}
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ app.use((req, res) => {
1616
redirectDomain = `www.${req.get("host")}`;
1717

1818
const proto = req.get("x-forwarded-proto") || req.protocol;
19+
const path = req.originalUrl === '/' ? '' : req.originalUrl;
1920

2021
if (redirectDomain)
21-
return res.redirect(`${proto}://${redirectDomain}${req.originalUrl}`);
22+
return res.redirect(`${proto}://${redirectDomain}${path}`);
2223
else if (req.path === "/status") return res.send("ok");
2324
else
2425
return res

0 commit comments

Comments
 (0)