Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

큰 틀에 아래와 같은 작업을 진행해야 함

====

Nginx 관련

server {
   listen 80 443;
   server_name example.com;
   
   ssl_certificate /.../.../.../certificate.pem;
   ssl_certificate_key /.../.../.../privkey.pem;
    
   ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
   ssl_prefer_server_ciphers on;
   ssl_dhparam /.../.../.../dhparam.pem;
   ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-$
   ssl_session_timeout 1d;
   ssl_session_cache shared:SSL:50m;
   ssl_stapling on;
   ssl_stapling_verify on;
   add_header Strict-Transport-Security max-age=15768000;
   
   location / {
      proxy_set_header 'Access-Control-Allow-Origin' 'https://test.test.domain';
      proxy_set_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE';
      proxy_set_header 'Access-Control-Allow-Headers' 'X-Requested-With,Accept,Content-Type, Origin';
      proxy_set_header 'Access-Control-Allow-Credentials' 'true';
      proxy_set_header 'Access-Control-Max-Age' 1728000;      

      
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;
      proxy_pass_header Set-Cookie;
      proxy_cache_bypass $cookie_nocache $arg_nocache $arg_comment;
      proxy_pass http://127.0.0.1:8675;
      proxy_redirect off;
    }

    gzip on;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_min_length  1000;
    gzip_disable     "MSIE [1-6]\."
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
 }
 
 server {
    listen 80;
    server_name lefthookservices.com  www.lefthookservices.com;
    return 301 https://$host$request_uri;
}

Express

...
var cors = require('cors');

app.post('/', function(request, response){

    response.header("Access-Control-Allow-Origin", "*");
    response.header("Access-Control-Allow-Headers", "X-Requested-With");
    response.header("Access-Control-Allow-Methods', 'GET,POST");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment