Skip to content

Commit df0ef54

Browse files
Configure proper proxy header pass to OpenAPI (#7)
1 parent c386a1a commit df0ef54

File tree

7 files changed

+13
-34
lines changed

7 files changed

+13
-34
lines changed

.github/workflows/on-release-tag.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ jobs:
6464
permissions:
6565
contents: read
6666
packages: write
67+
defaults:
68+
run:
69+
working-directory: ./frontend
6770
steps:
6871
- uses: actions/checkout@v5
6972

@@ -94,7 +97,7 @@ jobs:
9497
--build-arg VERSION=${VERSION} \
9598
-t ghcr.io/hackyourfuture/course-hub-frontend:${{ steps.get-version.outputs.version }} \
9699
-t ghcr.io/hackyourfuture/course-hub-frontend:latest \
97-
frontend
100+
.
98101
if [ "$DOCKER_PUSH" = "true" ]; then
99102
docker push ghcr.io/hackyourfuture/course-hub-frontend:${{ steps.get-version.outputs.version }}
100103
docker push ghcr.io/hackyourfuture/course-hub-frontend:latest

backend/src/main/java/net/hackyourfuture/coursehub/CourseHubApplication.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ public class CourseHubApplication {
88
public static void main(String[] args) {
99
SpringApplication.run(CourseHubApplication.class, args);
1010
}
11-
1211
}

backend/src/main/java/net/hackyourfuture/coursehub/SwaggerBehindReverseProxyConfig.java

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

backend/src/main/resources/application.properties

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ spring.datasource.password=course_user_password
88

99
# Server configuration
1010
server.port=8080
11+
# Configuration for handling forwarded headers (like X-Forwarded-For)
12+
server.forward-headers-strategy=framework
1113

1214
# Session in Redis Configuration
1315
# We want users to stay logged in for 7 days for convenience
1416
spring.session.timeout=7d
1517

16-
open-api.suffix=/api
17-
18-
springdoc.swagger-ui.url=${open-api.suffix}/v3/api-docs
19-
springdoc.swagger-ui.config-url=${open-api.suffix}/v3/api-docs/swagger-config

deployment/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ssh user@server
2222
cd /opt/course-hub
2323
```
2424

25-
Docker status
25+
Docker status:
2626
```bash
2727
docker stats
2828
```

deployment/docker-compose.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ services:
1717
condition: service_started
1818
course-hub-frontend:
1919
condition: service_started
20-
20+
2121
# Postgres, main data store used by course-hub-backend
2222
postgres:
2323
image: postgres:18
@@ -31,7 +31,7 @@ services:
3131
- postgres:/var/lib/postgresql
3232
ports:
3333
- "5432:5432"
34-
34+
3535
# Redis, auth session storage used by course-hub-backend
3636
redis:
3737
image: redis:7
@@ -46,23 +46,22 @@ services:
4646
restart: on-failure
4747
environment:
4848
BACKEND_URL: https://coursehub.hyf.dev/api
49-
49+
5050
course-hub-backend:
5151
image: ghcr.io/hackyourfuture/course-hub-backend:latest
5252
container_name: course-hub-backend
5353
restart: on-failure
5454
environment:
55-
JVM_TOOL_OPTS: -XX:ReservedCodeCacheSize=120M
55+
JAVA_OPTS: -XX:ReservedCodeCacheSize=120M
5656
BPL_JVM_THREAD_COUNT: 20
5757
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/coursehub
5858
SPRING_DATA_REDIS_HOST: redis
59-
OPEN_API_SUFFIX: /api
6059
depends_on:
6160
postgres:
6261
condition: service_started
6362
redis:
6463
condition: service_started
65-
64+
6665
# Agent that monitors whenever new versions of images are published and recreates the containers
6766
watchtower:
6867
image: containrrr/watchtower

deployment/nginx.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ server {
1010
proxy_set_header X-Real-IP $remote_addr;
1111
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
1212
proxy_set_header X-Forwarded-Proto $scheme;
13+
proxy_set_header X-Forwarded-Prefix /api;
1314
}
1415

1516
location / {

0 commit comments

Comments
 (0)