# Png picture not displayed on the site trought haproxy

**URL:** <https://discourse.haproxy.org/t/png-picture-not-displayed-on-the-site-trought-haproxy/11671>\
**Category:** Help!\
**Created:** [March 18, 2025, 10:16am UTC](https://discourse.haproxy.org/t/png-picture-not-displayed-on-the-site-trought-haproxy/11671 "2025-03-18T10:16:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bootdrv](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@bootdrv](https://discourse.haproxy.org/u/bootdrv)\
**Post date:** [March 18, 2025, 10:16am UTC](https://discourse.haproxy.org/t/png-picture-not-displayed-on-the-site-trought-haproxy/11671/1 "2025-03-18T10:16:35Z")

</div>

Hello! After setup haproxy, png picture not displayed on the site! On the application catalog have the file ‘test\_code\_location.png’. My colleague some time ago added to configs settings for show this picture, but picture still didn’t printed on the page site! may be they are setting was wrong! Instead of a picture on the site I see a picture icon! When I go to this web page without haproxy, the png picture successfully loading !  
How I can try fix it? Thanks

haproxy config:

defaults  
log global  
mode http

# option httplog

```
    option httplog clf

    log-format '"json_msg":{"client_ip":"%ci","client_port":"%cp","frontend_name":"%f","timestamp":"%Ts","frontend_name_transport":"%ft","backend_name":"%b","node_name":"%s","time":{"tq":%Tq,"tw":%Tw,"tc":%Tc,"tr":%Tr,"tt":%Tt},"res.status":"%ST","req.method":"%HM","request":"%HU","bytes_read":"%B","captured_request_cookie":"%CC","captured_response_cookie":"%CS","termination_state_with_cookie_status":"%tsc","actconn":"%ac","feconn":"%fc","beconn":"%bc","srv_conn":"%sc","retries":"%rc","srv_queue":"%sq","backend_queue":"%bq","req.host":"%[capture.req.hdr(0)]","referer":"%[capture.req.hdr(1)]","remote_addr":"%[capture.req.hdr(2)]","req.id":"%[capture.req.hdr(3)]","response_headers":"%hs"}'

    option dontlognull
    retries 3
    option redispatch
    timeout connect 280000
    timeout client 280000
    timeout server 280000
    errorfile 400 /etc/haproxy/errors/400.http
    errorfile 403 /etc/haproxy/errors/403.http
    errorfile 408 /etc/haproxy/errors/408.http
    errorfile 500 /etc/haproxy/errors/500.http
    errorfile 502 /etc/haproxy/errors/502.http
    errorfile 503 /etc/haproxy/errors/503.http
    errorfile 504 /etc/haproxy/errors/504.http

    option forwardfor
    option forwardfor header X-Real-IP
    option http-server-close

```

frontend check.front  
bind 127.0.0.1:8004 alpn h2,http/1.1  
#,spdy/3.1

```
    capture request header Host len 100
    capture request header Referer len 100
    capture request header X-Request-ID len 100

    # ?
    http-request add-header X-Forwarded-Proto https
    http-request add-header X-Request-ID %ID

    http-response set-header Strict-Transport-Security max-age=15768000;\ includeSubdomains;\ preload
    http-response set-header X-Frame-Options DENY
    http-response set-header X-Content-Type-Options nosniff

    acl url_css path_beg /test/css/
    use_backend test.back if url_css

    acl url_img path_beg /test/images/
    use_backend test.back if url_img

    acl url_test path_beg /test/
    use_backend test.back if url_test

```

# acl url\_img1 path /test\_code\_location.png

# use\_backend check.back if url\_img1

frontend checkvisa.front  
bind 127.0.0.1:8009 alpn h2,http/1.1  
#,spdy/3.1

```
    capture request header Host len 100
    capture request header Referer len 100
    capture request header X-Request-ID len 100

    # ?
    http-request add-header X-Forwarded-Proto https
    http-request add-header X-Request-ID %ID

    http-response set-header Strict-Transport-Security max-age=15768000;\ includeSubdomains;\ preload
    http-response set-header X-Frame-Options DENY
    http-response set-header X-Content-Type-Options nosniff

    acl url_css path_beg /test/css/
    use_backend test.back if url_css

    acl url_img path_beg /test/images/
    use_backend test.back if url_img

    acl url_test path_beg /test/
    use_backend test.back if url_test

```

# use\_backend test.back if { path /test\_code\_location.png }

```
    default_backend checkvisa.back

```

frontend reports.front  
bind 127.0.0.1:8010 alpn h2,http/1.1  
#,spdy/3.1

```
    capture request header Host len 100
    capture request header Referer len 100
    capture request header X-Request-ID len 100

    # ?
    http-request add-header X-Forwarded-Proto https
    http-request add-header X-Request-ID %ID

    http-response set-header Strict-Transport-Security max-age=15768000;\ includeSubdomains;\ preload
    http-response set-header X-Frame-Options DENY
    http-response set-header X-Content-Type-Options nosniff

    acl url_css path_beg /test/css/
    use_backend test.back if url_css

    acl url_img path_beg /test/images/
    use_backend test.back if url_img

    acl url_test path_beg /test/
    use_backend test.back if url_test

    use_backend test.back if { path /test_code_location.png }

    default_backend reports.back

```

backend check.back  
# proxy host/ to host/test (xxxx.test.ua to xxxx.test.ua/test)

# reqirep ^([^/]_)/(._) \1/test/checkcontract/?code=\2

```
    http-request replace-uri ^([^/]*)/(.*) \1/test/checkcontract/?code=\2

    # proxy cookie XSESSIONID Path=/evo.rc/checkcontract to Path=/
    # http-response replace-header Set-Cookie XSESSIONID=(.*);Path=/evo.rc/checkcontract(.*) XSESSIONID=\1;Path=/\2

```

# http-response replace-header Set-Cookie JSESSIONID=(._);Path=/test/checkcontract(._) JSESSIONID=\1;Path=/\2

```
    balance leastconn

    option httpchk HEAD /test/checkcontract/ HTTP/1.0
    option httpclose
    option forwardfor
    retry-on conn-failure empty-response 0rtt-rejected

    option log-health-checks

    server test-1 test-1:8080 check inter 8000 rise 2 fall 3 weight 100
    server test-2 test-2:8080 check inter 8000 rise 2 fall 3 weight 100
    server test-3 test-3:8080 check inter 8000 rise 2 fall 3 weight 100

```

---

<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:** [March 18, 2025, 4:28pm UTC](https://discourse.haproxy.org/t/png-picture-not-displayed-on-the-site-trought-haproxy/11671/2 "2025-03-18T16:28:31Z")

</div>

Complex `reqirep` and `http-request replace-uri` rules are intervening and changing the request URI.

Remove them if you don’t want URI changes.

I would strongly suggest to simplify your configuration.

---

<div class="post-metadata">

**Author:** ![bootdrv](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@bootdrv](https://discourse.haproxy.org/u/bootdrv)\
**Post date:** [March 19, 2025, 7:08am UTC](https://discourse.haproxy.org/t/png-picture-not-displayed-on-the-site-trought-haproxy/11671/3 "2025-03-19T07:08:01Z")

</div>

Hello, lukastribus! Thanks so much! I’ll try!

---

<div class="post-metadata">

**Author:** ![bootdrv](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@bootdrv](https://discourse.haproxy.org/u/bootdrv)\
**Post date:** [March 19, 2025, 10:08am UTC](https://discourse.haproxy.org/t/png-picture-not-displayed-on-the-site-trought-haproxy/11671/4 "2025-03-19T10:08:37Z")

</div>

lukastribus, when I tried comments strings ‘http-request replace-uri ^([^/]_)/(._) \1/test/checkcontract/?code=\2’ the host was down! I restored previouse setting . May be this string need modificate and replace another parametrs? Thanks!

---

<div class="post-metadata">

**Author:** ![bootdrv](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@bootdrv](https://discourse.haproxy.org/u/bootdrv)\
**Post date:** [March 26, 2025, 12:39pm UTC](https://discourse.haproxy.org/t/png-picture-not-displayed-on-the-site-trought-haproxy/11671/5 "2025-03-26T12:39:50Z")

</div>

http-request replace-uri ^([^/]_)/(._) \1/test/checkcontract/\2 -fixed issue! Picture loaded!
