Skip to content

Instantly share code, notes, and snippets.

@max-l
Created February 2, 2015 16:18
Show Gist options
  • Save max-l/b05b5cb6255eeea020e8 to your computer and use it in GitHub Desktop.
Save max-l/b05b5cb6255eeea020e8 to your computer and use it in GitHub Desktop.
Galaxy nginx config
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 443 ssl;
ssl_certificate {{genapHostProxyHome}}/{{certName}}.crt;
ssl_certificate_key /genap_ssl/{{certName}}.pem;
lua_code_cache {{luaCodeCache}};
set $secret '{{secretKey}}';
set $p '';
set $isDisplay '';
set $backendHost '';
set $backendPort '';
set $loginOnHost '';
set $pathPrefix '';
set $backendHostCodeName '';
set $expiryTime '';
set $newSignature '';
set $errorMsg '';
location / {
set_by_lua_file $p {{genapLuaModulePath}}/validateGenapCookies.lua;
if ($p ~ __PROXY_ERROR) {
return 302 {{PORTAL_URL_PREFIX}}/proxyError/$errorMsg;
}
if ($p ~ __BAD_SIGNATURE) {
echo "bad signature";
return 400;
}
if ($p ~ __INCOMPLETE_OR_NO_COOKIE) {
return 302 {{PORTAL_URL_PREFIX}}/needsLogin;
}
if ($p ~ __SESSION_TIMED_OUT) {
return 302 {{PORTAL_URL_PREFIX}}/timedout/$backendHost/$backendPort;
}
if ($p ~ __APPLICATION_INSTANCE_UNAUTHORIZED) {
return 302 {{PORTAL_URL_PREFIX}}/hostUnauthorizedOrNoLogin/$backendHostCodeName/$backendHost/$backendPort;
}
proxy_set_header REMOTE_USER "$loginOnHost";
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-URL-SCHEME https;
if ($p ~ __OK) {
proxy_pass http://$backendHost:$backendPort$pathPrefix$uri$is_args$args;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment