Skip to content

Commit

Permalink
Merge pull request #162 from kookmin-sw/feature/be/#159-ApiRateLimiter
Browse files Browse the repository at this point in the history
fix: api 문서 접근 가능하게 변경
  • Loading branch information
mclub4 authored May 5, 2024
2 parents 5f3398c + 99ce300 commit 7522b15
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
run: |
echo DB_ENDPOINT=${{ secrets.DB_ENDPOINT }} >> .env
echo DB_NAME=${{ secrets.DB_NAME }} >> .env
echo DB_PORT=${{ secrets.DB_PORT }} >> .env
echo MYSQL_USERNAME=${{ secrets.MYSQL_USERNAME }} >> .env
echo MYSQL_PASSWORD=${{ secrets.MYSQL_PASSWORD }} >> .env
echo JWT_SECRET=${{ secrets.JWT_SECRET }} >> .env
Expand All @@ -35,7 +36,7 @@ jobs:
echo S3_ACCESS_KEY=${{ secrets.S3_ACCESS_KEY }} >> .env
echo S3_SECRET_KEY=${{ secrets.S3_SECRET_KEY }} >> .env
echo SECRET_KEY_BASE=${{ secrets.SECRET_KEY_BASE }} >> .env
echo SEVER_NAME=${{ secrets.SERVER_NAME }} >> .env
echo SERVER_NAME=${{ secrets.SERVER_NAME }} >> .env
echo SERVER_URL=${{ secrets.SERVER_URL }} >> .env
echo CHATBOT_URL=${{ secrets.CHATBOT_URL }} >> .env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class GatewayConfig {
public RouteLocator gatewayRoutes(RouteLocatorBuilder builder,
AuthorizationHeaderFilter authFilter) {
return builder.routes()
.route("chatbot",r -> r.path("/docs", "/openapi.json")
.uri(chatbotUrl))
.route("chatbot",r -> r.path("/api/chatbot/**")
.filters(f->f.filter(authFilter.apply(config -> {config.setRequiredRole("role_user");})))
.uri(chatbotUrl))
Expand Down
2 changes: 1 addition & 1 deletion back/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM nginx
COPY test.conf.template /etc/nginx/conf.d/default.conf.template
COPY default.conf.template /etc/nginx/conf.d/default.conf.template
ENTRYPOINT ["/bin/bash", "-c", "envsubst '${SERVER_NAME}' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"]
21 changes: 4 additions & 17 deletions back/nginx/default.conf.template
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
upstream spring_backend {
server spring:8080;
}

upstream ruby_backend {
server ruby:3000;
upstream spring_gateway {
server spring_gateway:8081;
}

server {
Expand Down Expand Up @@ -35,17 +31,8 @@ server {
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

location /api {
proxy_pass http://spring_backend;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
}

location /api/chat {
proxy_pass http://ruby_backend;
location / {
proxy_pass http://spring_gateway;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
Expand Down

0 comments on commit 7522b15

Please sign in to comment.