Skip to content

Commit

Permalink
fixes in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lyokha committed Feb 19, 2024
1 parent 609e693 commit 75d1c7b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 13 deletions.
20 changes: 16 additions & 4 deletions NgxExport/Tools/Subrequest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -560,15 +560,15 @@ ngxExportSimpleServiceTyped 'configureUDS ''UDSConf SingleShotService
--
-- ==== File /nginx.conf/: configuring the custom manager
-- @
-- haskell_run_service __/simpleService_configureUdsManager/__ $hs_service_manager
-- haskell_run_service __/simpleService_configureUdsManager/__ $hs_service_myuds
-- \'\/tmp\/myuds.sock\';
-- @
--
-- ==== File /nginx.conf/: location /\/uds/ with custom manager /myuds/
-- ==== File /nginx.conf/: new location /\/myuds/ in server /main/
-- @
-- location \/uds {
-- location \/myuds {
-- haskell_run_async __/makeSubrequest/__ $hs_subrequest
-- \'{\"uri\": \"http:\/\/backend_proxy\/\"
-- \'{\"uri\": \"http:\/\/backend_proxy_myuds\/\"
-- ,\"headers\": [[\"Custom-Header\", \"$arg_a\"]]
-- ,\"__/manager/__\": \"__myuds__\"
-- }\';
Expand All @@ -582,6 +582,18 @@ ngxExportSimpleServiceTyped 'configureUDS ''UDSConf SingleShotService
-- echo -n $hs_subrequest;
-- }
-- @
--
-- ==== File /nginx.conf/: new virtual server /backend_proxy_myuds/
-- @
-- server {
-- listen unix:\/tmp\/myuds.sock;
-- server_name backend_proxy_myuds;
--
-- location \/ {
-- proxy_pass http:\/\/backend;
-- }
-- }
-- @

-- | Registers a custom HTTP manager with a given key.
--
Expand Down
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2089,16 +2089,16 @@ ngxExportSimpleService 'configureUdsManager SingleShotService
###### File *nginx.conf*: configuring the custom manager

```nginx
haskell_run_service simpleService_configureUdsManager $hs_service_manager
haskell_run_service simpleService_configureUdsManager $hs_service_myuds
'/tmp/myuds.sock';
```

###### File *nginx.conf*: location */uds* with custom manager *myuds*
###### File *nginx.conf*: new location */myuds* in server *main*

```nginx
location /uds {
location /myuds {
haskell_run_async makeSubrequest $hs_subrequest
'{"uri": "http://backend_proxy"
'{"uri": "http://backend_proxy_myuds"
,"headers": [["Custom-Header", "$arg_a"]]
,"manager": "myuds"
}';
Expand All @@ -2113,6 +2113,19 @@ ngxExportSimpleService 'configureUdsManager SingleShotService
}
```

###### File *nginx.conf*: new virtual server *backend_proxy_myuds*

```nginx
server {
listen unix:/tmp/myuds.sock;
server_name backend_proxy_myuds;
location / {
proxy_pass http://backend;
}
}
```

---

Handlers *makeSubrequest* and *makeSubrequestWithRead* return response body
Expand Down
10 changes: 5 additions & 5 deletions test/Subrequest/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ http {
haskell_run_service simpleService_configureUDS $hs_service_uds
'UDSConf {udsPath = "/tmp/backend.sock"}';
haskell_run_service simpleService_configureUdsManager $hs_service_manager
haskell_run_service simpleService_configureUdsManager $hs_service_myuds
'/tmp/myuds.sock';
haskell_var_empty_on_error $hs_subrequest;
Expand Down Expand Up @@ -91,17 +91,17 @@ http {
echo -n $hs_subrequest;
}

location /custom {
location /myuds {
haskell_run_async makeSubrequest $hs_subrequest
'{"uri": "http://backend_proxy_2"
'{"uri": "http://backend_proxy_myuds/"
,"headers": [["Custom-Header", "$arg_a"]]
,"manager": "myuds"
}';

# the same configuration for using with makeSubrequestWithRead
#
# 'SubrequestConf { srMethod = ""
# , srUri = "http://127.0.0.1:8010/proxy"
# , srUri = "http://backend_proxy_myuds/"
# , srBody = ""
# , srHeaders = [("Custom-Header", "$arg_a")]
# , srResponseTimeout =
Expand Down Expand Up @@ -259,7 +259,7 @@ http {
server {
listen unix:/tmp/myuds.sock;
server_name backend_proxy_2;
server_name backend_proxy_myuds;
location / {
proxy_pass http://backend;
Expand Down

0 comments on commit 75d1c7b

Please sign in to comment.