You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/08/18 06:58:03 UTC

[GitHub] [apisix-dashboard] believe1499 opened a new issue, #2594: 在apisix中如何实现这段Nginx的配置

believe1499 opened a new issue, #2594:
URL: https://github.com/apache/apisix-dashboard/issues/2594

   # Feature request
   在apisix中如何实现这段Nginx的配置
   `    location ~ ^/apisix/test/(.*)? {
           if ($request_method = 'OPTIONS') {
               add_header 'Access-Control-Allow-Origin' '*' always;
               add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
               add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
               add_header 'Access-Control-Max-Age' 1728000;
               add_header 'Content-Type' 'text/plain charset=UTF-8';
               add_header 'Content-Length' 0;
               return 204;
           }
           if ($request_method = 'GET') {
               add_header 'Access-Control-Allow-Origin' '*' always;
               add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
               add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
           }
   
           if ($request_method = 'POST') {
               add_header 'Access-Control-Allow-Origin' '*' always;
               add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
               add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
           }
   
           proxy_pass    http://192.168.1.125:8080/$1;
           proxy_http_version 1.1;
           proxy_set_header Connection "upgrade";
           proxy_pass_header  Authorization;
           proxy_set_header Authorization $http_authorization;
           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_set_header Via "apisix.test.cn";
           proxy_redirect      off;
       }`
   1、如何实现以上的if语句判断,根据不同的method需要添加不同的header(通过创建多个不同的路由规则?)
   2、如何设置proxy_set_header(通过proxy-rewrite插件?)
   3、如何设置proxy_pass_header
   ## Please describe your feature
   
   A clear and concise description of what you want and what your use case is.
   
   ## Describe the solution you'd like
   
   A clear and concise description of what you want to happen.
   
   ## Describe alternatives you've considered
   
   A clear and concise description of any alternative solutions or features you've considered.
   
   ## Additional context
   
   Add any other context or screenshots about the feature request here.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-dashboard] believe1499 closed issue #2594: 在apisix中如何实现这段Nginx的配置

Posted by GitBox <gi...@apache.org>.
believe1499 closed issue #2594: 在apisix中如何实现这段Nginx的配置
URL: https://github.com/apache/apisix-dashboard/issues/2594


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org