Skip to content

Commit

Permalink
feat: nginx adventures #3
Browse files Browse the repository at this point in the history
  • Loading branch information
akifisitan committed May 12, 2024
1 parent ae2eb64 commit 326502f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
14 changes: 8 additions & 6 deletions ovatify-backend/microservices/api-gateway/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,33 @@ events {

http {

ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;

default_type application/json;


upstream auth_service {
server ovtf-auth-srv-clpiqqqcgq-ew.a.run.app;
server ovtf-auth-srv-clpiqqqcgq-ew.a.run.app:443;
}

upstream recommendation_service {
server recommendation-service-clpiqqqcgq-ew.a.run.app;
server recommendation-service-clpiqqqcgq-ew.a.run.app:443;
}

upstream user_service {
server user-service-clpiqqqcgq-ew.a.run.app;
server user-service-clpiqqqcgq-ew.a.run.app:443;
}

server {
listen 80;

error_log /var/log/nginx/error.log debug;
set $auth_service_host ovtf-auth-srv-clpiqqqcgq-ew.a.run.app;
set $recommendation_service_host recommendation-service-clpiqqqcgq-ew.a.run.app;
set $user_service_host user-service-clpiqqqcgq-ew.a.run.app;

include /etc/nginx/conf.d/auth_service.conf;
include /etc/nginx/conf.d/recommendation_service.conf;
include /etc/nginx/conf.d/user_service.conf;

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# proxy_settings.conf
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# auth_service_routes.conf
location /users/create-user/ {
proxy_pass https://auth_service;
proxy_set_header Host $auth_service_host;
include /etc/nginx/conf.d/proxy_settings.conf;
}

location /users/login/ {
proxy_pass https://auth_service;
proxy_set_header Host $auth_service_host;
include /etc/nginx/conf.d/proxy_settings.conf;
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# recommendation_service_routes.conf
location /users/recommend-you-might-like/ {
proxy_pass https://recommendation_service;
proxy_set_header Host $recommendation_service_host;
include /etc/nginx/conf.d/proxy_settings.conf;
}

location /users/recommend-since-you-like/ {
proxy_pass https://recommendation_service;
proxy_set_header Host $recommendation_service_host;
include /etc/nginx/conf.d/proxy_settings.conf;
}

location /users/recommend-friend-mix/ {
proxy_pass https://recommendation_service;
proxy_set_header Host $recommendation_service_host;
include /etc/nginx/conf.d/proxy_settings.conf;
}

location /users/recommend-friend-listen/ {
proxy_pass https://recommendation_service;
proxy_set_header Host $recommendation_service_host;
include /etc/nginx/conf.d/proxy_settings.conf;
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# user_service_routes.conf
location /users/get-user-profile/ {
proxy_pass https://user_service;
proxy_set_header Host $user_service_host;
include /etc/nginx/conf.d/proxy_settings.conf;
}

location /users/edit-user-preferences/ {
proxy_pass https://user_service;
proxy_set_header Host $user_service_host;
include /etc/nginx/conf.d/proxy_settings.conf;
}

location /users/delete-user/ {
proxy_pass https://user_service;
proxy_set_header Host $user_service_host;
include /etc/nginx/conf.d/proxy_settings.conf;
}

0 comments on commit 326502f

Please sign in to comment.