Re: [I] bug: environment variable values mixed in proxy-rewrite plugin [apisix]

2024-04-05 Thread via GitHub


hanqingwu commented on issue #11121:
URL: https://github.com/apache/apisix/issues/11121#issuecomment-2040956925

   Yes, Maybe I can reproduce,  But I don't  know why . So if I  change 
`SOME_STRING_VALUE_BUT_DIFFERENT` to `STRING_VALUE_BUT_DIFFERENT`  then  plugin 
 work fine . 
   I will try to find out .


-- 
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-unsubscr...@apisix.apache.org

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



Re: [I] feat: As a sysadmin, I want to install on RedHat9, so that I can use it [apisix]

2024-04-05 Thread via GitHub


shreemaan-abhishek commented on issue #9:
URL: https://github.com/apache/apisix/issues/9#issuecomment-2040892157

   Building from source FTW!


-- 
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-unsubscr...@apisix.apache.org

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



Re: [I] bug: aws-lambda plugin with IAM auth fails with URL-encoded query parameters [apisix]

2024-04-05 Thread via GitHub


shreemaan-abhishek commented on issue #11097:
URL: https://github.com/apache/apisix/issues/11097#issuecomment-2040890019

   > I'd need it to support [IAM roles for service 
accounts](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html),
 which it currently doesn't.
   
   If this is a separate feature, please create an issue describing this 
feature request, then we can move forward with whether or not we should have 
it. After that we can return to this issue. WDYT?


-- 
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-unsubscr...@apisix.apache.org

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



Re: [PR] docs: New blog post about building APISIX in SLES15 [apisix-website]

2024-04-05 Thread via GitHub


shreemaan-abhishek commented on code in PR #1787:
URL: https://github.com/apache/apisix-website/pull/1787#discussion_r1554485426


##
blog/en/blog/2024/04/05/build-apisix-in-sles15.md:
##
@@ -0,0 +1,86 @@
+---
+title: "How to build APISIX in SLES 15"
+authors:
+  - name: "Oier Saizar"
+title: "Author"
+url: "https://github.com/osaizar;
+image_url: "https://avatars.githubusercontent.com/u/9879984;
+keywords: 
+- Apache APISIX
+- SLES
+- Suse
+description: By reading this article, you will learn how to build Apache 
APISIX for Suse Linux Enterprise 15
+tags: [Ecosystem]
+---
+
+> By reading this article you will learn how to build Apache APISIX SLES 15 
from source code.
+> The build process will be done in the [SLE BCI 15 SP5 Base 
Container](https://registry.suse.com/categories/bci/repositories/bci-bci-base-15sp5)
+
+
+
+## Install dependencies
+Before starting to build APISIX we need to install some dependencies needed to 
launch the build process:
+
+```shell
+zypper install -y git sudo make wget
+```
+
+## Clone the APISIX repository
+Next, we can clone the APISIX repository:
+
+```shell
+git clone https://github.com/apache/apisix.git
+cd apisix
+```
+
+## Modify the utils/install-dependencies.sh script
+Currently the `utils/install-dependencies.sh` script does not support SLES 15, 
so we will need to modify it slightly to add support for this distro:
+
+```shell
+wget 
https://raw.githubusercontent.com/osaizar/apisix/master/utils/install-dependencies.sh

Review Comment:
   I think we are better off having the shell script in the blog post itself. 
WDYT @yzeng25?



-- 
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-unsubscr...@apisix.apache.org

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



Re: [I] feat: SUSE Linux Enterprise Server 15 support [apisix]

2024-04-05 Thread via GitHub


osaizar commented on issue #5:
URL: https://github.com/apache/apisix/issues/5#issuecomment-2040491526

   I made a PR to the apisix-website repository adding a blog post, you can 
find the steps on how to build in SLES 15 there:
   https://github.com/apache/apisix-website/pull/1787
   
   I had to make changes to  `utils/install-dependencies.sh`, I can make a PR 
to this repository if you like.


-- 
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-unsubscr...@apisix.apache.org

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



[PR] docs: New blog post aboutBuilding APISIX in SLES15 [apisix-website]

2024-04-05 Thread via GitHub


osaizar opened a new pull request, #1787:
URL: https://github.com/apache/apisix-website/pull/1787

   Fixes: #[Add issue number here]
   
   Changes:
   
   
   
   Screenshots of the change:
   
   
   


-- 
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-unsubscr...@apisix.apache.org

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



Re: [PR] feat: Autogenerate admin api key if not passed [apisix]

2024-04-05 Thread via GitHub


shreemaan-abhishek commented on code in PR #11080:
URL: https://github.com/apache/apisix/pull/11080#discussion_r1553983796


##
apisix/core/id.lua:
##
@@ -20,17 +20,23 @@
 -- @module core.id
 
 local fetch_local_conf = require("apisix.core.config_local").local_conf
-local try_read_attr= require("apisix.core.table").try_read_attr
-local log  = require("apisix.core.log")
-local uuid = require('resty.jit-uuid')
-local smatch   = string.match
-local open = io.open
-
-
+local try_read_attr = require("apisix.core.table").try_read_attr
+local profile = require("apisix.core.profile")
+local log = require("apisix.core.log")
+local uuid = require("resty.jit-uuid")
+local lyaml = require("lyaml")
+local smatch = string.match
+local open = io.open
+local type = type
+local ipairs = ipairs
+local string = string
+local math = math
 local prefix = ngx.config.prefix()
 local apisix_uid
+local pairs = pairs
+local ngx_exit = ngx.exit
 
-local _M = {version = 0.1}
+local _M = { version = 0.1 }

Review Comment:
   please revert this change.



##
t/fuzzing/simple_http.py:
##
@@ -41,10 +49,18 @@ def create_route():
 }
 })
 conn = connect_admin()
+key = get_admin_key_from_yaml('conf/config.yaml')
+if key is None:
+print("Key not found in the YAML file.")
+return
+key = key.replace('"', '')
+print("the key is",key)

Review Comment:
   ```suggestion
   print("the key is", key)
   ```



##
apisix/core/id.lua:
##
@@ -20,17 +20,23 @@
 -- @module core.id
 
 local fetch_local_conf = require("apisix.core.config_local").local_conf
-local try_read_attr= require("apisix.core.table").try_read_attr
-local log  = require("apisix.core.log")
-local uuid = require('resty.jit-uuid')
-local smatch   = string.match
-local open = io.open
-
-
+local try_read_attr = require("apisix.core.table").try_read_attr

Review Comment:
   please maintain code beautification (equals on top of each other)



##
.github/workflows/source-install.yml:
##
@@ -88,8 +88,15 @@ jobs:
 
   - name: Test apisix
 run: |
-  curl http://127.0.0.1:9180/apisix/admin/routes/1 \
--H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+wget 
https://github.com/mikefarah/yq/releases/download/3.4.1/yq_linux_amd64 -O 
/usr/bin/yq && sudo chmod +x /usr/bin/yq

Review Comment:
   this block has 4 indents, where as everywhere in this file there are 2 
indents.



##
apisix/core/id.lua:
##
@@ -61,19 +63,88 @@ local function write_file(path, data)
 return true
 end
 
+local function generate_yaml(table)
+-- By default lyaml will parse null values as []
+-- The following logic is a workaround so that null values are parsed as 
null
+local function replace_null(tbl)
+for k, v in pairs(tbl) do
+if type(v) == "table" then
+replace_null(v)
+elseif v == nil then
+tbl[k] = ""
+end
+end
+end
+
+-- Replace null values with ""
+replace_null(table)
+
+-- Convert Lua table to YAML string without parsing null values
+local yaml = lyaml.dump({ table }, { no_nil = true })
+
+-- Replace "" with null except for empty arrays
+yaml = yaml:gsub("", "null"):gsub("%[%s*%]", "null")
+
+-- Ensure boolean values remain intact
+yaml = yaml:gsub(":%s*true%s*true", ": true"):gsub(":%s*false%s*true", ": 
false")
+
+-- Replace *no_nil with true
+yaml = yaml:gsub("_nil", "true")
+
+-- Remove any occurrences of *no_nil
+yaml = yaml:gsub(":%s*%*no_nil", ": true")
+
+-- Remove duplicates for boolean values
+yaml = yaml:gsub("true%s*true", "true"):gsub("false%s*false", "false")
+
+return yaml
+end
+
 
 _M.gen_uuid_v4 = uuid.generate_v4
 
+--- This will autogenerate the admin key if it's passed as an empty string in 
the configuration.
+local function autogenerate_admin_key(default_conf)
+local changed = false
+-- Check if deployment.admin.admin_key is not nil and it's an array
+local admin_keys = default_conf.deployment
+and default_conf.deployment.admin
+and default_conf.deployment.admin.admin_key
+if admin_keys and type(admin_keys) == "table" then
+for i, admin_key in ipairs(admin_keys) do
+if admin_key.role == "admin" and admin_key.key == "" then
+changed = true
+admin_keys[i].key = ""
+for _ = 1, 32 do
+admin_keys[i].key = admin_keys[i].key ..
+string.char(math.random(65, 90) + math.random(0, 1) * 32)
+end

Review Comment:
   @Revolyssup please address these comments.



##
conf/config-default.yaml:
##
@@ -170,7 +170,8 @@ nginx_config: # Config for render the 
template to generate n
   

[I] bug: environment variable values mixed in proxy-rewrite plugin [apisix]

2024-04-05 Thread via GitHub


jompu opened a new issue, #11121:
URL: https://github.com/apache/apisix/issues/11121

   ### Current Behavior
   
   The proxy-rewrite plugin uses value from wrong environment variable, when 
configured with standalone configuration. 
   
   ### Expected Behavior
   
   _No response_
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   config.yaml
   ```yaml
   apisix:
 node_listen: 
 enable_ipv6: false
 enable_admin: false
 ssl:
   enable: false
   
   deployment:
 role: data_plane
 role_data_plane:
   config_provider: yaml
   ```
   
   apisix.yaml
   ```yaml
   upstreams:
 - id: echoserver
   pass_host: rewrite
   upstream_host: echo.free.beeceptor.com
   scheme: https
   nodes:
 - host: echo.free.beeceptor.com
   port: 443
   weight: 1
   plugin_configs:
 - id: validaterequest
   plugins:
 request-validation:
   header_schema:
 type: object
 required: 
   - X-random-request-header
 properties:
   X-random-request-header:
 type: string
 pattern: '^${{SOME_STRING_VALUE}}$'
   routes:
 - name: test
   uri: /test
   plugin_config_id: validaterequest
   plugins:
 proxy-rewrite:
   uri: /some/api/endpoint
   headers:
 set:
   X-Some-String-Value-But-Different: "Different 
${{SOME_STRING_VALUE_BUT_DIFFERENT}}"
   X-Some-String-Value: ${{SOME_STRING_VALUE}}
   upstream_id: echoserver
   #END
   ```
   
   The issue does not happen always, anyway try below steps multiple times and 
it happens at some point. Quite often it happens at the first time though. The 
apisix.yaml is just an example that I have used to reproduce the problem.
   
   1. Run container
   ```sh
   docker run --env SOME_STRING_VALUE_BUT_DIFFERENT=astringvaluebutdifferent \
 --env SOME_STRING_VALUE=astringvalue \
 -v $(pwd)/config.yaml:/usr/local/apisix/conf/config.yaml:ro \
 -v $(pwd)/apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro \
 -p :/tcp apache/apisix:3.9.0-debian
   ```
   2. Run curl: `curl -H "X-random-request-header: astringvalue" 
http://localhost:/test`
 - You should receive a json that shows headers set by the proxy-rewrite 
plugin. 
 - Header values should be like this:
 X-Some-String-Value: "astringvalue"
 X-Some-String-Value-But-Different: "Different astringvaluebutdifferent"
   - if this is the case, stop the container and go back to step 1
   
   The problem is that some times the values at step 2 are like this (which is 
wrong):
 X-Some-String-Value: "astringvalue"
 X-Some-String-Value-But-Different: "Different astringvalue"
   
   Restarting the pod or just reloading the configuration (e.g. by editing 
apisix.yaml file) will fix the problem.
   
   A script to run steps repeatedly and stop when the issue happens:
   ```sh
   #!/bin/bash
   
   SOME_STRING_VALUE_BUT_DIFFERENT=astringvaluebutdifferent
   SOME_STRING_VALUE=astringvalue
   
   start_container () {
 docker run -d --env 
SOME_STRING_VALUE_BUT_DIFFERENT=$SOME_STRING_VALUE_BUT_DIFFERENT \
   --env SOME_STRING_VALUE=$SOME_STRING_VALUE \
   -v $(pwd)/config.yaml:/usr/local/apisix/conf/config.yaml:ro \
   -v $(pwd)/apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro \
   -p :/tcp apache/apisix:3.9.0-debian
   }
   
   run_curl () {
 curl -s -H "X-random-request-header: astringvalue" 
http://localhost:/test
   }
   
   run_curl_get_header () {
 run_curl | jq -r ".headers[\"$1\"]"
   }
   
   counter=1
   while :; do
 container_id=$(start_container)
 sleep 5
   
 butdifferentvalue=$(run_curl_get_header 
"X-Some-String-Value-But-Different")
   
 if [ "$butdifferentvalue" != "Different $SOME_STRING_VALUE_BUT_DIFFERENT" 
]; then
   echo
   echo "X-Some-String-Value-But-Different header was set with value 
'Different $SOME_STRING_VALUE', when it should be 'Different 
$SOME_STRING_VALUE_BUT_DIFFERENT'."
   echo "We had to repeate the test $counter times."
   echo; echo
   echo "Here is the wrong echoserver response:"
   echo
   run_curl
   
   docker rm -f $container_id > /dev/null
   break
 fi
   
 docker rm -f $container_id > /dev/null
   
 echo "Test succeeded, let's try again!"
 sleep 1
 counter=$((counter+1))
   done
   ```
   
   
   ### Environment
   
   - Docker image:  apache/apisix:3.9.0-debian



-- 
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-unsubscr...@apisix.apache.org.apache.org

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



Re: [I] help request: Proxy Cache Plugin -- How to set cache_ttl for disk strategy? [apisix]

2024-04-05 Thread via GitHub


kayx23 commented on issue #11120:
URL: https://github.com/apache/apisix/issues/11120#issuecomment-2039732940

   You would adjust the value in config.yaml. See 
https://docs.api7.ai/hub/proxy-cache/configuration#static-configurations


-- 
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-unsubscr...@apisix.apache.org

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



Re: [I] upstream not found warning in logs [apisix-ingress-controller]

2024-04-05 Thread via GitHub


rkazak07 commented on issue #2202:
URL: 
https://github.com/apache/apisix-ingress-controller/issues/2202#issuecomment-2039689471

   I'm getting the same warnings too


-- 
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-unsubscr...@apisix.apache.org

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



Re: [I] help request: Connect to upstream through proxy server (http_proxy) [apisix]

2024-04-05 Thread via GitHub


PlasticJonbenetDoll closed issue #11102: help request: Connect to upstream 
through proxy server (http_proxy)
URL: https://github.com/apache/apisix/issues/11102


-- 
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-unsubscr...@apisix.apache.org

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



[I] help request: Proxy Cache Plugin -- How to set cache_ttl for disk strategy? [apisix]

2024-04-05 Thread via GitHub


PlasticJonbenetDoll opened a new issue, #11120:
URL: https://github.com/apache/apisix/issues/11120

   ### Description
   
   Hi,
   I want to know is it possible to set time for how long the Apisix will 
return cached response if I use disk strategy?
   
   ### Environment
   
   - APISIX version (run `apisix version`): 3.6
   - Operating system (run `uname -a`):
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
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-unsubscr...@apisix.apache.org.apache.org

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



Re: [I] bug: function _M.run_plugin , if a plugin has error, the request will be error [apisix]

2024-04-05 Thread via GitHub


github-actions[bot] commented on issue #9218:
URL: https://github.com/apache/apisix/issues/9218#issuecomment-2039398864

   This issue has been marked as stale due to 350 days of inactivity. It will 
be closed in 2 weeks if no further activity occurs. If this issue is still 
relevant, please simply write any comment. Even if closed, you can still revive 
the issue at any time or discuss it on the d...@apisix.apache.org list. Thank 
you for your contributions.


-- 
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-unsubscr...@apisix.apache.org

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



Re: [I] help request: Obtain the real IP address of the client [apisix]

2024-04-05 Thread via GitHub


github-actions[bot] closed issue #9211: help request: Obtain the real IP 
address of the client
URL: https://github.com/apache/apisix/issues/9211


-- 
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-unsubscr...@apisix.apache.org

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



Re: [I] help request: Obtain the real IP address of the client [apisix]

2024-04-05 Thread via GitHub


github-actions[bot] commented on issue #9211:
URL: https://github.com/apache/apisix/issues/9211#issuecomment-2039398820

   This issue has been closed due to lack of activity. If you think that is 
incorrect, or the issue requires additional review, you can revive the issue at 
any time.


-- 
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-unsubscr...@apisix.apache.org

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



Re: [I] proposal: Google reCAPTCHA plugin [apisix]

2024-04-05 Thread via GitHub


github-actions[bot] commented on issue #6550:
URL: https://github.com/apache/apisix/issues/6550#issuecomment-2039398759

   This issue has been marked as stale due to 350 days of inactivity. It will 
be closed in 2 weeks if no further activity occurs. If this issue is still 
relevant, please simply write any comment. Even if closed, you can still revive 
the issue at any time or discuss it on the d...@apisix.apache.org list. Thank 
you for your contributions.


-- 
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-unsubscr...@apisix.apache.org

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



Re: [I] bug: 最新版本中支持的指标过期特性似乎会导致指标输出时会丢失部分已过期并重新添加的列表。 [apisix]

2024-04-05 Thread via GitHub


lgang06 commented on issue #3:
URL: https://github.com/apache/apisix/issues/3#issuecomment-2039323236

   @hanqingwu @monkeyDluffy6017  提交了pr,用于修复此问题,有时间帮check一下。


-- 
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-unsubscr...@apisix.apache.org

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



Re: [I] bug: 最新版本中支持的指标过期特性似乎会导致指标输出时会丢失部分已过期并重新添加的列表。 [apisix]

2024-04-05 Thread via GitHub


lgang06 commented on issue #3:
URL: https://github.com/apache/apisix/issues/3#issuecomment-2039096939

   复现步骤:
   apache/apisix:3.9.0-redhat 镜像启动,使用yaml配置route如下
   
   routes:
 -
   uri: /hello
   upstream:
   nodes:
   "127.0.0.1:1980": 1
   type: roundrobin
   global_rules:
 - 
   id: 1
   plugins:
 prometheus:
   prefer_name: true
   #END
   
   
   普米过期设置10s,
   
   启动apisix,执行下面请求后,
   curl -Ssl "127.0.0.1:9080/hello" > /dev/null && sleep 12 && curl -Ssl 
"127.0.0.1:9091/apisix/prometheus/metrics" | grep 'route'
   之后再执行指标不会输出指标
   curl -Ssl "127.0.0.1:9080/hello" > /dev/null && sleep 2 && curl -Ssl 
"127.0.0.1:9091/apisix/prometheus/metrics" | grep 'route'
   https://github.com/apache/apisix/assets/9103138/db06a796-d50e-4356-8544-b2f550ecd19e;>
   
   


-- 
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-unsubscr...@apisix.apache.org

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