# Cloudflare bouncer not working?

**URL:** https://discourse.crowdsec.net/t/cloudflare-bouncer-not-working/1122
**Category:** Uncategorized
**Created:** [January 27, 2023, 2:41am UTC](https://discourse.crowdsec.net/t/cloudflare-bouncer-not-working/1122 "2023-01-27T02:41:22Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![jameswong3388](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/jameswong3388/32/516_2.png) [@jameswong3388](https://discourse.crowdsec.net/u/jameswong3388)
#### Post date: [January 27, 2023, 2:41am UTC](https://discourse.crowdsec.net/t/cloudflare-bouncer-not-working/1122/1 "2023-01-27T02:41:22Z")

</div>

Not sure if Cloudflare bouncer works correctly here.

In the bouncer log:  
time=“26-01-2023 21:45:04” level=fatal msg=“LAPI can’t be reached”

But in crowdsec log /v1/decisions/stream returned 200

Heres is my config

```auto
  ###############################################
  #### Crowdsec #####
  ###############################################
  crowdsec:
    image: crowdsecurity/crowdsec:latest
    container_name: crowdsec
    restart: unless-stopped
    environment:
      GID: "${GID-1000}"
      COLLECTIONS: "crowdsecurity/linux crowdsecurity/linux-lpe crowdsecurity/traefik crowdsecurity/sshd crowdsecurity/base-http-scenarios crowdsecurity/http-cve" #<== define collection to analyse the logs of those containers
    depends_on:
      - traefik
    ports:
      - 127.0.0.1:8080:8080
    volumes:
      - ./crowdsec-data/config/acquis.yaml:/etc/crowdsec/acquis.yaml
      - ./crowdsec-data/config/db:/var/lib/crowdsec/data/
      - ./crowdsec-data/config/config:/etc/crowdsec/
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /var/log/:/var/log/:ro
    networks:
      - proxy

  bouncer-cloudflare:
    image: crowdsecurity/cloudflare-bouncer:latest
    container_name: proxy-bouncer-cloudflare
    restart: always
    networks:
      - proxy
    depends_on:
      - crowdsec
    volumes:
      - ./crowdsec-data/bouncer/cloudflare/cfg.yaml:/etc/crowdsec/bouncers/crowdsec-cloudflare-bouncer.yaml      

```

```auto
# CrowdSec Config
crowdsec_lapi_url: http://crowdsec:8080/
crowdsec_lapi_key: ******************************** #docker exec crowdsec cscli -oraw bouncers add cloudflare-bouncer
crowdsec_update_frequency: 10s
include_scenarios_containing: [] # ignore IPs banned for triggering scenarios not containing either of provided word, eg ["ssh", "http"]
exclude_scenarios_containing: [] # ignore IPs banned for triggering scenarios containing either of provided word
only_include_decisions_from: [] # only include IPs banned due to decisions orginating from provided sources. eg value ["cscli", "crowdsec"]

#Cloudflare Config. 
cloudflare_config:
  accounts:
  - id: 
    token: 
    ip_list_prefix: crowdsec    
    default_action: block # valid choices are either of challenge, js_challenge, block
    total_ip_list_capacity: 10000 # only this many latest ip scoped decisions would be kept
    zones:    
    - actions:       
      - block # valid choices are either of challenge, js_challenge, block      
      zone_id: 

  update_frequency: 30s # the frequency to update the cloudflare IP list 

# Bouncer 
daemon: true
log_mode: file
log_dir: /var/log/ 
log_level: debug # valid choices are either debug, info, error
log_max_size: 40
log_max_age: 30
log_max_backups: 3
compress_logs: true

prometheus:  
  enabled: false  
  # listen_addr: 127.0.0.1  
  # listen_port: 2112

```

---

<div class="post-metadata">

### Author: ![thibault](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/thibault/32/2_2.png) [@thibault](https://discourse.crowdsec.net/u/thibault)
#### Post date: [January 31, 2023, 4:44pm UTC](https://discourse.crowdsec.net/t/cloudflare-bouncer-not-working/1122/2 "2023-01-31T16:44:37Z")

</div>

Hello,

The bouncer can’t connect/speak to your local API.  
Try to connect manually to the local API url/port, that you configured in the bouncer.

---

<div class="post-metadata">

### Author: ![jameswong3388](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/jameswong3388/32/516_2.png) [@jameswong3388](https://discourse.crowdsec.net/u/jameswong3388)
#### Post date: [February 7, 2023, 10:17pm UTC](https://discourse.crowdsec.net/t/cloudflare-bouncer-not-working/1122/3 "2023-02-07T22:17:36Z")

</div>

How can i connect manually ?

---

<div class="post-metadata">

### Author: ![iiAmLoz](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/iiamloz/32/386_2.png) [@iiAmLoz](https://discourse.crowdsec.net/u/iiAmLoz)
#### Post date: [February 8, 2023, 10:44am UTC](https://discourse.crowdsec.net/t/cloudflare-bouncer-not-working/1122/4 "2023-02-08T10:44:32Z")

</div>

Exec into the bouncer container OR connect a container to the same network and try to `curl http://crowdsec:8080/`

---

<div class="post-metadata">

### Author: ![jameswong3388](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/jameswong3388/32/516_2.png) [@jameswong3388](https://discourse.crowdsec.net/u/jameswong3388)
#### Post date: [February 8, 2023, 12:53pm UTC](https://discourse.crowdsec.net/t/cloudflare-bouncer-not-working/1122/5 "2023-02-08T12:53:00Z")

</div>

can you be more specific on Exec?  
docker exec crowdsec …?

---

<div class="post-metadata">

### Author: ![iiAmLoz](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/iiamloz/32/386_2.png) [@iiAmLoz](https://discourse.crowdsec.net/u/iiAmLoz)
#### Post date: [February 8, 2023, 8:03pm UTC](https://discourse.crowdsec.net/t/cloudflare-bouncer-not-working/1122/6 "2023-02-08T20:03:56Z")

</div>

Yes docker exec or docker compose exec

---

<div class="post-metadata">

### Author: ![jameswong3388](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/jameswong3388/32/516_2.png) [@jameswong3388](https://discourse.crowdsec.net/u/jameswong3388)
#### Post date: [February 9, 2023, 7:51am UTC](https://discourse.crowdsec.net/t/cloudflare-bouncer-not-working/1122/7 "2023-02-09T07:51:47Z")

</div>

what is the option? ou didn’t answer my question  
docker exec crowdsec ?

---

<div class="post-metadata">

### Author: ![iiAmLoz](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/iiamloz/32/386_2.png) [@iiAmLoz](https://discourse.crowdsec.net/u/iiAmLoz)
#### Post date: [February 9, 2023, 10:33am UTC](https://discourse.crowdsec.net/t/cloudflare-bouncer-not-working/1122/8 "2023-02-09T10:33:47Z")

</div>

That because the answer changes depending on your setup. Exec a container is a basic docker command to learn. I will presume some stuff then EG your on latest docker and using the compose plugin and not the script version.

So run this then.

```auto
docker compose exec proxy-bouncer-cloudflare apk add curl && curl -vv http://crowdsec:8080/health

```

You are expecting to see a response 200 code with some json data.

---

<div class="post-metadata">

### Author: ![jameswong3388](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/jameswong3388/32/516_2.png) [@jameswong3388](https://discourse.crowdsec.net/u/jameswong3388)
#### Post date: [February 10, 2023, 7:52am UTC](https://discourse.crowdsec.net/t/cloudflare-bouncer-not-working/1122/9 "2023-02-10T07:52:55Z")

</div>

Cant seem to run the command tho, but it showed that the container ins running on my portainer instance.

Error response from daemon: Container 8cb6feb01601bbd880087bb82f7dec3fc32b0f050841d6fec5c7fecdf2e5ff04 is restarting, wait until the container is running

---

<div class="post-metadata">

### Author: ![iiAmLoz](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/iiamloz/32/386_2.png) [@iiAmLoz](https://discourse.crowdsec.net/u/iiAmLoz)
#### Post date: [February 15, 2023, 9:40am UTC](https://discourse.crowdsec.net/t/cloudflare-bouncer-not-working/1122/10 "2023-02-15T09:40:47Z")

</div>

This is going to be difficult to debug if you cannot work around this without portainer. Next step would be to create a container and attach it to the proxy network. Alpine image will be enough. Then within alpine do:

```auto
apk add curl && curl -s http://crowdsec:8080/health

```
