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 2023/01/06 05:57:24 UTC

[GitHub] [apisix] chenyyyang opened a new issue, #8626: help request: how to use fixed values as response content

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

   ### Description
   
   APISIX_VERSION=2.11.0
   the method from the below picture seems not work...Could you give more advise
   ![image](https://user-images.githubusercontent.com/22273370/210939290-5d4c9eed-757b-4645-bafc-51abf124bdab.png)
   
   
   ### Environment
   
   - APISIX version (run `apisix version`):
   - 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-unsubscribe@apisix.apache.org.apache.org

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


[GitHub] [apisix] chenyyyang commented on issue #8626: help request: how to use fixed values as response content

Posted by GitBox <gi...@apache.org>.
chenyyyang commented on issue #8626:
URL: https://github.com/apache/apisix/issues/8626#issuecomment-1373314380

   @ronething  Good job!many thanks.
   


-- 
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


[GitHub] [apisix] chenyyyang commented on issue #8626: help request: how to use fixed values as response content

Posted by GitBox <gi...@apache.org>.
chenyyyang commented on issue #8626:
URL: https://github.com/apache/apisix/issues/8626#issuecomment-1373204020

   @ronething  thank you for your response.
   The pic is generated via asking ChatGPT from OpenAI's website...
   
   Is there another way due to the priority of response-write (899) is much bigger than my self-devloped plugin?
   Since i can not change the priority.


-- 
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


[GitHub] [apisix] ronething commented on issue #8626: help request: how to use fixed values as response content

Posted by GitBox <gi...@apache.org>.
ronething commented on issue #8626:
URL: https://github.com/apache/apisix/issues/8626#issuecomment-1373279997

   Maybe you can try `serverless-post-function` plugin, refer: https://apisix.apache.org/docs/apisix/plugins/serverless/
   
   ```
   $ curl http://127.0.0.1:9180/apisix/admin/routes/1 \
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uri": "/hello",
       "plugins": {
           "serverless-post-function": {
               "phase": "rewrite",
               "functions" : ["return function(conf, ctx) return 200, \"Hello, World!\" end"] 
           }
       },
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "127.0.0.1:80": 1
           }
       }
   }'
   ```


-- 
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


[GitHub] [apisix] chenyyyang closed issue #8626: help request: how to use fixed values as response content

Posted by GitBox <gi...@apache.org>.
chenyyyang closed issue #8626: help request: how to use fixed values as response content
URL: https://github.com/apache/apisix/issues/8626


-- 
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


[GitHub] [apisix] ronething commented on issue #8626: help request: how to use fixed values as response content

Posted by GitBox <gi...@apache.org>.
ronething commented on issue #8626:
URL: https://github.com/apache/apisix/issues/8626#issuecomment-1373198081

   @chenyyyang Hi, where is your pic come from? And if you want to return fixed_value, you can use `response-write` plugin. 
   
   refer: https://apisix.apache.org/docs/apisix/plugins/response-rewrite/
   
   ```
   curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "methods": ["GET"],
       "uri": "/hello",
       "plugins": {
           "response-rewrite": {
               "body": "Hello, World!"
           }
       },
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "127.0.0.1:80": 1
           }
       }
   }'
   ```


-- 
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