#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
	
    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Headers X-Requested-With;
    add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

    server {
        root /usr/share/nginx/html/;

        location /game/v1 {
            rewrite ^/icore.icp.web/game(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://oa-system-game-service/v1; # 转发地址
        }
        
        location /views/icore.icp.web/pass/v1 {
		    rewrite ^/b/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
			port_in_redirect   on;
			proxy_redirect     off;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://paas-sso/v1; # 转发地址
        }
        location /icore.icp.web/pass/v1 {
            rewrite ^/b/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://paas-sso/v1; # 转发地址
        }
        location /icore.icp.web/pass/logout {
            rewrite ^/b/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://paas-sso/logout; # 转发地址
        }
        location /icore.icp.web/pass/auth {
            rewrite ^/b/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://paas-sso/auth; # 转发地址
        }
        location /icore.icp.web/pass/img {
            rewrite ^/b/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://paas-sso/img; # 转发地址
        }
        location /icore.icp.web/pass/service {
            rewrite ^/b/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://paas-sso/service; # 转发地址
        }		
        location /icore.icp.web/pass/configCenter {
		    proxy_pass http://paas-config/configCenter; # 转发地址
			port_in_redirect   on;
			proxy_redirect     off;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        location /icore.icp.web/pass/serviceCenter {
		    proxy_pass http://paas-govern/serviceCenter; # 转发地址 
			port_in_redirect   on;
			proxy_redirect     off;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        location /icore.icp.web/pass/act {
            rewrite ^/icore.icp.web/pass/act/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://paas-act; # 转发地址
        }
        location /graphql {
		    proxy_pass http://devops-api.devops/graphql; # 转发地址
			port_in_redirect   on;
			proxy_redirect     off;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        location /cloudGraphql {
		    proxy_pass http://devops-api.devops/graphql; # 转发地址
			port_in_redirect   on;
			proxy_redirect     off;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        location /devopsApi {
		    proxy_pass https://devops-api.devops/graphql; # 转发地址
            rewrite ^/devopsApi/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
			port_in_redirect   on;
			proxy_redirect     off;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_http_version 1.1;                                                                
            proxy_set_header Upgrade $http_upgrade;                                                
            proxy_set_header Connection "Upgrade";
        }
        location /icore-api {
            rewrite ^/icore-api/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://paas-sso; # 转发地址
        }
        location /icore.icp.web/pass/kafka {
            rewrite ^/icore.icp.web/pass/kafka/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://paas-kafka; # 转发地址
        }
        location /icore.icp.web/pass/job {
            rewrite ^/icore.icp.web/pass/job/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://paas-job; # 转发地址
        }
        location /icore.icp.web/pass/productAuth {
            rewrite ^/icore.icp.web/pass/productAuth/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://paas-product-auth; # 转发地址
        }
        location /icore.icp.web/pass/dd {
            rewrite ^/icore.icp.web/pass/dd/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://paas-dd-service; # 转发地址
        }
        location /icore.icp.web/pass/apiauth {
            rewrite ^/icore.icp.web/pass/apiauth(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://paas-auth-service; # 转发地址
        }
        location /icore.icp.web/pass/websocket {
            rewrite ^/icore.icp.web/pass/websocket(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://paas-websocket; # 转发地址
        }
        location /devops-images {
            proxy_pass http://devops-api.devops; # 转发地址
            port_in_redirect   on;
            proxy_redirect     off;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        location /pass/devops {
            # rewrite ^/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://10.10.50.51:9080; # 转发地址
        }
        location /authManage {
            # rewrite ^/(.*)$ /$1 break; # 去除本地接口/api前缀, 否则会出现404
            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_pass http://10.10.50.62:20000; # 转发地址
        }
     }
}