mscb402 commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1325915767

   So maybe you should try this route config
   ```
   {
     "uri": "/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8",
     "name": "test",
     "host": "run.mocky.io",
     "plugins": {
       "file-logger": {
         "path": "logs/file.log"
       }
     },
     "upstream": {
       "nodes": [
         {
           "host": "run.mocky.io",
           "port": 443,
           "weight": 1
         }
       ],
       "type": "roundrobin",
       "hash_on": "vars",
       "scheme": "https",
       "pass_host": "pass"
     },
     "status": 1
   }
   ```
   
   keep mind `host` is add to config.
   
   and then access this route from curl
   
   ```
   curl -i http://127.0.0.1:9080/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8 -H 
"Host: run.mocky.io" 
   ```
   
   there is what you will get
   
   ```
   HTTP/1.1 200 OK
   Content-Type: application/json; charset=UTF-8
   Content-Length: 16
   Connection: keep-alive
   Date: Thu, 24 Nov 2022 03:37:50 GMT
   Sozu-Id: 01GJKVD31W1TN8WFR0NW0NPFJQ
   Server: APISIX/3.0.0
   
   {"result": "ok"}
   ```
   
   And the file log will append:
   ```
   ## tail -n1 file.log
   
   
{"response":{"status":200,"size":222,"headers":{"sozu-id":"01GJKVD31W1TN8WFR0NW0NPFJQ","content-length":"16","server":"APISIX\/3.0.0","connection":"close","date":"Thu,
 24 Nov 2022 03:37:50 GMT","content-type":"application\/json; 
charset=UTF-8"}},"apisix_latency":0,"route_id":"00000000000000000032","server":{"hostname":"bd257b6c70bc","version":"3.0.0"},"client_ip":"172.20.0.1","request":{"uri":"\/v3\/bc8fdfcd-0392-49fa-8520-c8644d1688c8","size":115,"querystring":{},"method":"GET","url":"http:\/\/run.mocky.io:9080\/v3\/bc8fdfcd-0392-49fa-8520-c8644d1688c8","headers":{"accept":"*\/*","host":"run.mocky.io","user-agent":"curl\/7.84.0"}},"start_time":1669261068867,"upstream_latency":1702,"latency":1701.9999027252,"service_id":"","upstream":"46.252.181.103:443"}
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to