- Notifications
You must be signed in to change notification settings - Fork 86
Open
Description
Using ?force_sync=yes when updating an entry in a map file loaded as a regex (map_reg), won't update the file on disk and it returns a 404. In-memory version (runtime) will be updated.
- State before running the update:
$ cat maps/paths.map ^/api apiservers ^/cart cartservers% $ echo "show map maps/paths.map" | socat stdio /tmp/admin.sock 0x104414cb0 ^/api apiservers 0x104414d10 ^/cart cartservers - Running update via Data Plane API. Notice the
HTTP/1.1 404 Not Found
$ curl -v --request PUT \ --url 'http://127.0.0.1:5555/v3/services/haproxy/runtime/maps/paths.map/entries/%5E%2Fapi?force_sync=true' \ --header 'authorization: Basic YWRtaW46YWRtaW4=' \ --header 'content-type: application/json' \ --data '{"value": "newapiservers" }' * Trying 127.0.0.1:5555... * Connected to 127.0.0.1 (127.0.0.1) port 5555 > PUT /v3/services/haproxy/runtime/maps/paths.map/entries/%5E%2Fapi?force_sync=true HTTP/1.1 > Host: 127.0.0.1:5555 > User-Agent: curl/8.7.1 > Accept: */* > authorization: Basic YWRtaW46YWRtaW4= > content-type: application/json > Content-Length: 30 > * upload completely sent off: 30 bytes < HTTP/1.1 404 Not Found < Configuration-Version: 1 < Content-Type: application/json < Vary: Origin < Date: Fri, 19 Dec 2025 16:01:06 GMT < Content-Length: 0 < * Connection #0 to host 127.0.0.1 left intact - State after the update. notice how runtime shows the new (expected value)
$ echo "show map maps/paths.map" | socat stdio /tmp/admin.sock 0x104414cb0 ^/api newapiservers 0x104414d10 ^/cart cartservers $ cat maps/paths.map ^/api apiservers ^/cart cartservers% haproxy.cfg
global stats socket /tmp/admin.sock mode777 level admin defaults defaults mode http frontend www from defaults bind:8888# Choose which backend depending on the URL path use_backend%[path,map_reg(maps/paths.map,webservers)] default_backend webservers backend webservers from defaults http-request return status 200 content-type "text/plain" lf-string "200 OK" hdr "X-Backend" "webservers" backend apiservers from defaults http-request return status 200 content-type "text/plain" lf-string "200 OK" hdr "X-Backend" "apiservers" backend cartservers from defaults http-request return status 200 content-type "text/plain" lf-string "200 OK" hdr "X-Backend" "cartservers"dataplaneapi.yml
dataplaneapi: socket_path: ./data-plane.sock host: 127.0.0.1 port: 5555 pid_file: ./dataplaneapi.pid scheme: - http - unix transaction: transaction_dir: ./storage/transactions backups_number: 10 backups_dir: ./storage/backups resources: maps_dir: ./maps ssl_certs_dir: ./storage/ssl general_storage_dir: ./storage/general dataplane_storage_dir: ./storage/dataplane spoe_dir: ./storage/spoe spoe_transaction_dir: ./storage/transactions/spoe user: - name: admin insecure: true password: admin haproxy: config_file: ./haproxy.cfg haproxy_bin: /opt/homebrew/bin/haproxy reload: reload_strategy: systemd log_targets: - log_to: stdout log_level: debug log_format: text log_types: - app - access I didn't experience this when updating "regular" (or "literal) map files loaded with map directive.
Metadata
Metadata
Assignees
Labels
No labels