# Convert Small Nginx Config to HAProxy

**URL:** <https://discourse.haproxy.org/t/convert-small-nginx-config-to-haproxy/728>\
**Category:** Help!\
**Created:** [October 15, 2016, 10:03am UTC](https://discourse.haproxy.org/t/convert-small-nginx-config-to-haproxy/728 "2016-10-15T10:03:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxbridgewater](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@maxbridgewater](https://discourse.haproxy.org/u/maxbridgewater)\
**Post date:** [October 15, 2016, 10:03am UTC](https://discourse.haproxy.org/t/convert-small-nginx-config-to-haproxy/728/1 "2016-10-15T10:03:48Z")

</div>

Please, I need some help converting this NGINX config to HAProxy. Essentially, the config extracts IP address, the port, and the relative path from the overall URL and dynamically redirect to this extracted server. One thing that might not be obvious from this config is that it also does websocket. This explains some of the weird settings you would see (e.g. upgrade).

Any help would be much appreciated.

server {  
listen 80;

```
location ~ ^/forward/([^/]+)/([^/]+)/(.*)$ {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_http_version 1.1;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;
    proxy_pass http://$1:$2/$3;
}

```

}

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [October 15, 2016, 11:47am UTC](https://discourse.haproxy.org/t/convert-small-nginx-config-to-haproxy/728/2 "2016-10-15T11:47:42Z")

</div>

You can’t do this with haproxy. Haproxy has fixed backend servers.
