0

Given a backend that running on:

172.18.1.125:8888

curl tested:

curl --location --request GET "http://172.18.1.125:8888/oauth/sign-key"
sample_response    //>> HERE IS RESPONSE

On another host, I install and config haproxy:

global
    log         /dev/log local0
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    debug
    user        haproxy
    group       haproxy
    daemon

    stats socket /var/lib/haproxy/stats
    ssl-default-bind-ciphers PROFILE=SYSTEM
    ssl-default-server-ciphers PROFILE=SYSTEM

defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

frontend api_gateway
    bind :80
    acl PATH_auth path_beg /api/authorization/

    use_backend be_auth if PATH_auth

backend be_auth
    server s1 172.18.1.125:8888
    http-request set-header Host 172.18.1.125

After that I use curl to test my haproxy:

curl --location --request GET "http://localhost/api/authorization/oauth/sign-key"

I expect that this request will be route to:

http://172.18.1.125:8888/oauth/sign-key

But I got 503 error instead:

<html><body><h1>503 Service Unavailable</h1>
No server is available to handle this request.
</body></html>

What am I wrong or missing?

1 Answer 1

1

im guessing you are going to http://172.18.1.125:8888/api/authorization/oauth/sign-key instead of 172.18.1.125:8888/oauth/sign-key like you expect cause you are doing nothing to strip out 'api/authorization' ... try this backend:

backend be_auth
    http-request set-path %[path,regsub(^/api/authorization/,/)]
    server s1 172.18.1.125:8888
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .