Created
December 23, 2021 07:20
-
-
Save MahdiKarimipour/009bfa6acc8916b9294c8491be700b64 to your computer and use it in GitHub Desktop.
Pellerex Realtime Messaging Ingress Configs
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
ingress: | |
enabled: true | |
className: "" | |
annotations: | |
# This needs to be specific domains, otherwise SignalR will fail | |
nginx.ingress.kubernetes.io/configuration-snippet: | | |
if ($http_origin ~* "^https?://((?:www\.domain-a\.com)|(?:www\.domain-b\.com)|(?:www\.domain-c\.io)|(?:www\.domain-d\.com))$") { | |
set $cors "true"; | |
} | |
if ($request_method = 'OPTIONS') { | |
set $cors "${cors}options"; | |
} | |
if ($cors = "true") { | |
add_header 'Access-Control-Allow-Origin' "$http_origin" always; | |
add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, PATCH, OPTIONS' always; | |
add_header 'Access-Control-Allow-Headers' 'x-signalr-user-agent,x-requested-with,Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent' always; | |
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always; | |
} | |
if ($cors = "trueoptions") { | |
add_header 'Access-Control-Allow-Origin' "$http_origin"; | |
add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, PATCH, OPTIONS'; | |
add_header 'Access-Control-Allow-Headers' 'x-signalr-user-agent,x-requested-with,Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent'; | |
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; | |
add_header 'Access-Control-Max-Age' 1728000; | |
add_header 'Content-Type' 'text/plain charset=UTF-8'; | |
add_header 'Content-Length' 0; | |
return 204; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment