Last active
January 15, 2024 01:28
-
-
Save a2z-ice/20a2691bf1570ca797d25d15e84fe0a6 to your computer and use it in GitHub Desktop.
nginx.confg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
server { | |
listen 80; | |
server_name shopecom-service; | |
# This configuration fix issue when the browser reloads | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
include /etc/nginx/mime.types; | |
# Compression | |
gzip on; | |
gzip_min_length 1000; | |
gzip_proxied expired no-cache no-store private auth; | |
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; | |
add_header Access-Control-Allow-Origin *; | |
# Angular app configuration. The frontend | |
location / { | |
try_files $uri $uri/ /index.html; | |
} | |
# Resource server the backend APIs proxy pass | |
location /api { | |
proxy_pass http://shopecom-api:8000; | |
# rewrite /api/(.*) /$1 break; | |
proxy_redirect off; | |
add_header Allow "GET, POST, HEAD" always; | |
proxy_set_header Host $host; | |
} | |
# Keycloak proxy pass configuration for dev realm | |
location ~ (/realms/dev|/resources) { | |
proxy_pass http://keycloak:8080; | |
autoindex off; | |
server_tokens off; | |
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; | |
### Set headers #### | |
proxy_set_header Accept-Encoding ""; | |
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; | |
add_header Front-End-Https on; | |
### By default we don't want to redirect it #### | |
proxy_redirect off; | |
### For big url request | |
proxy_busy_buffers_size 512k; | |
proxy_buffers 4 512k; | |
proxy_buffer_size 256k; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment