Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #http {
- # map $http_accept_language $accept_language {
- # ~*^hu hu;
- # }
- #}
- server {
- listen 443 ssl;
- add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
- server_name app.medalyst.io;
- root /opt/dist;
- ssl on;
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
- ssl_ciphers HIGH:!aNULL:!MD5;
- #put your certificate here:
- ssl_certificate /etc/nginx/ssl/medalyst_chain_cert.pem;
- #and the key for it here:
- ssl_certificate_key /etc/nginx/ssl/medalyst_key.pem;
- if ($accept_language ~ "^$") {
- set $accept_language "en";
- }
- rewrite ^/((?!hu)(?!en)(?!de)(?!api)(?!resource).*)$ /$accept_language/$1 permanent;
- location /hu/ {
- alias /opt/dist/hu/;
- try_files $uri$args $uri$args/ /hu/index.html;
- }
- location /en/ {
- alias /opt/dist/en/;
- try_files $uri$args $uri$args/ /en/index.html;
- }
- location /de/ {
- alias /opt/dist/de/;
- try_files $uri$args $uri$args/ /de/index.html;
- }
- location /resource/image {
- alias /opt/medalyst/data;
- }
- location /api {
- if ($request_method = 'OPTIONS') {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
- add_header 'Access-Control-Max-Age' 1728000;
- add_header 'Content-Type' 'text/plain charset=UTF-8';
- add_header 'Content-Length' 0;
- return 204;
- }
- if ($request_method = 'POST') {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
- }
- if ($request_method = 'GET') {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
- }
- proxy_set_header X-Forwarded-Host $host;
- proxy_set_header X-Forwarded-Server $host;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_pass http://127.0.0.1:8080/api;
- }
- }
- server {
- listen 80;
- server_name app.medalyst.io;
- location / {
- return 301 https://app.medalyst.io$request_uri;
- }
- }
- server {
- listen 443;
- add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
- server_name app.medalyst.io;
- location / {
- if ($request_method = 'OPTIONS') {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
- add_header 'Access-Control-Max-Age' 1728000;
- add_header 'Content-Type' 'text/plain charset=UTF-8';
- add_header 'Content-Length' 0;
- return 204;
- }
- if ($request_method = 'POST') {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
- }
- if ($request_method = 'GET') {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
- }
- return 301 https://app.medalyst.io$request_uri;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement