Skip to content

Conversation

@jmozd
Copy link

@jmozd jmozd commented Sep 1, 2022

Proposed changes

support CORS by providing a custom annotation to Ingress', which then is reflected in the NGINX ingress configuration.

By adding the custom annotation "custom.nginx.org/cors-allow-origin" to an ingress, with the value of the target server (i.e. "https://sample.server.org/"), the according NGINX ingress configuration is created in the "server {}" section:

# replace Access-Control-Allow-Origin header 
proxy_hide_header "Access-Control-Allow-Origin"; 
add_header Access-Control-Allow-Origin "https://sample.server.org";

Hiding the original header values proved to be required, as else the browser might complain about multiple set values.

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

@codecov-commenter
Copy link

Codecov Report

Merging #3004 (cbbd5ff) into main (39eefc4) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #3004      +/-   ##
==========================================
+ Coverage   52.54%   52.56%   +0.01%     
==========================================
  Files          58       58              
  Lines       16069    16069              
==========================================
+ Hits         8444     8446       +2     
+ Misses       7349     7347       -2     
  Partials      276      276              
Impacted Files Coverage Δ
...ternal/k8s/appprotect/app_protect_configuration.go 86.74% <0.00%> (+0.57%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jasonwilliams14
Copy link
Contributor

We are reviewing this internally and are planning this for a future release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants