Skip to content
Snippets Groups Projects
Commit 345f4a09 authored by Abelangel's avatar Abelangel
Browse files

nginx fonctionnel pour service helloworld mais toujours probleme cors avec service auth

parent 64589fef
No related branches found
No related tags found
No related merge requests found
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE';
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';
# Gestion des requêtes OPTIONS
if ($request_method = OPTIONS) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE';
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Length' 0;
add_header 'Content-Type' 'text/plain charset=UTF-8';
return 204;
}
......@@ -6,13 +6,14 @@ services:
build: ./frontend
ports:
- "4200:4200"
networks:
- backend_network
nginx:
image: nginx:latest
container_name: nginx-proxy
ports:
- "30992:30992" # 🚀 Le frontend appelle toujours 30992, donc on l'expose
- "30992:30992" # Frontend communique avec Nginx sur ce port
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./cors.conf:/etc/nginx/cors.conf:ro
......@@ -42,48 +43,50 @@ services:
service-helloworld:
image: service-helloworld
build: ./helloworld
expose:
- "8002" # 🚀 Utilisé par Nginx
ports:
- "8002:30992" # Expose pour les tests locaux si nécessaire
networks:
- backend_network
service-auth:
image: service-auth
build: ./auth
expose:
- "8001"
ports:
- "8001:30992"
environment:
- API_PORT=30992 # S'assurer que le service écoute sur le bon port
networks:
- backend_network
service-correction-qcm:
image: service-correction-qcm
build: ./correction_qcm
expose:
- "8003"
ports:
- "8003:30992"
networks:
- backend_network
service-realise-qcm:
image: service-realise-qcm
build: ./realise_qcm
expose:
- "8005"
ports:
- "8005:30992"
networks:
- backend_network
service-search-qcm:
image: service-search-qcm
build: ./search_qcm
expose:
- "8006"
ports:
- "8006:30992"
networks:
- backend_network
service-creation-qcm:
image: service-creation-qcm
build: ./creation_qcm
expose:
- "8004"
ports:
- "8004:30992"
networks:
- backend_network
......
events {
worker_connections 1024;
}
......@@ -9,179 +8,70 @@ http {
sendfile on;
keepalive_timeout 65;
server {
listen 80;
listen 30992;
# Redirection des services
location /auth/jwt {
proxy_pass http://service-auth:30992;
include cors.conf;
}
location /helloworld {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
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;
proxy_pass http://service-helloworld:30992;
include cors.conf;
}
location /auth/jwt {
proxy_pass http://localhost:8001;
proxy_set_header Host $host;
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;
}
location /reponseCorrect/:QCM_ID {
proxy_pass http://localhost:8002;
proxy_set_header Host $host;
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;
location /reponseCorrect/ {
proxy_pass http://service-correction-qcm:30992;
include cors.conf;
}
location /responses_QCM/:QCM_ID/:USER_ID {
proxy_pass http://localhost:8002;
proxy_set_header Host $host;
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;
location /responses_QCM/ {
proxy_pass http://service-correction-qcm:30992;
include cors.conf;
}
location /feedback {
proxy_pass http://localhost:8002;
proxy_set_header Host $host;
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;
}
location /results/:QCM_ID {
proxy_pass http://localhost:8002;
proxy_set_header Host $host;
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;
proxy_pass http://service-correction-qcm:30992;
include cors.conf;
}
location /QCM {
proxy_pass http://localhost:8003;
proxy_set_header Host $host;
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;
proxy_pass http://service-creation-qcm:30992;
include cors.conf;
}
location /numeric_question {
proxy_pass http://localhost:8003;
proxy_set_header Host $host;
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;
}
location /response/:ANSWER_ID {
proxy_pass http://localhost:8005;
proxy_set_header Host $host;
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;
proxy_pass http://service-creation-qcm:30992;
include cors.conf;
}
location /response {
proxy_pass http://localhost:8005;
proxy_set_header Host $host;
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;
}
location /numeric_response/:ANSWER_ID {
proxy_pass http://localhost:8005;
proxy_set_header Host $host;
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;
}
location /terminer/:USER_ID/:QCM_ID {
proxy_pass http://localhost:8005;
proxy_set_header Host $host;
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;
}
location /join {
proxy_pass http://localhost:8005;
proxy_set_header Host $host;
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;
}
location /question/:QUESTION_ID {
proxy_pass http://localhost:8005;
proxy_set_header Host $host;
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;
}
location /text_question {
proxy_pass http://localhost:8005;
proxy_set_header Host $host;
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;
}
location /numeric_response {
proxy_pass http://localhost:8005;
proxy_set_header Host $host;
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;
}
location /true_false_question {
proxy_pass http://localhost:8005;
proxy_set_header Host $host;
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;
proxy_pass http://service-realise-qcm:30992;
include cors.conf;
}
location /realised_QCMs/:USER_ID {
proxy_pass http://localhost:8006;
proxy_set_header Host $host;
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;
location /terminer {
proxy_pass http://service-realise-qcm:30992;
include cors.conf;
}
location /created_QCMs/:USER_ID {
proxy_pass http://localhost:8006;
proxy_set_header Host $host;
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;
location /question {
proxy_pass http://service-realise-qcm:30992;
include cors.conf;
}
location /examen_QCM/:QCM_ID {
proxy_pass http://localhost:8006;
proxy_set_header Host $host;
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;
location /realised_QCMs {
proxy_pass http://service-search-qcm:30992;
include cors.conf;
}
location /infos_QCM/:QCM_ID {
proxy_pass http://localhost:8006;
proxy_set_header Host $host;
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;
location /created_QCMs {
proxy_pass http://service-search-qcm:30992;
include cors.conf;
}
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment