Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"CORS or Network issue" error in browser when List refresh blocky #1606

Open
sborca opened this issue Sep 16, 2024 · 6 comments
Open

"CORS or Network issue" error in browser when List refresh blocky #1606

sborca opened this issue Sep 16, 2024 · 6 comments

Comments

@sborca
Copy link

sborca commented Sep 16, 2024

Hello!
I run blocky app on an lxc container on Nokia router with OpenWRT as host OS, and when I trigger a List refresh action in WEB UI I got the error("CORS or Network issue"):
CORSErr

All the other API requests works perfectly.
Do you know why?
My config.yml file looks like this:

blocking:
denylists:
ads:
- https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
- https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
- http://sysctl.org/cameleon/hosts
- https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
clientGroupsBlock:
default:
- ads
loading:
refreshPeriod: 24h
downloads:
timeout: 60s
strategy: fast
ports:
dns: 1053
http: 4000

Thank you very much!

@sborca
Copy link
Author

sborca commented Oct 8, 2024

Hello! any answer for my question?

@TheoTechnicguy
Copy link
Contributor

Hi! I am having difficulties diagnosing and reproducing your issue. Can you provide other useful information like the logs of blocky and your browser?

To help out the community, I would like to kindly request formatting your configuration file. GitHub supports Markdown, so you can delimit your configuration file with triple backticks (see https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code)

Doing so will help us save time formatting the configuration file and allow us to invest this time resolving the issue.

The reference configuration file I used for my tests is the following. Can you confirm it reflects yours?

bootstrapDns:
- upstream: https://cloudflare-dns.com/dns-query
  ips:
  - 104.16.248.249
  - 104.16.249.249
upstreams:
  timeout: 2s
  strategy: strict
  groups:
    default:
    - tcp+udp:1.1.1.1

blocking:
  denylists:
    ads:
    - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
    - https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
    - http://sysctl.org/cameleon/hosts
    - https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
  clientGroupsBlock:
    default:
    - ads
  loading:
    refreshPeriod: 24h
    downloads:
      timeout: 60s
    strategy: fast
ports:
  dns: 1053
  http: 4000

@sborca
Copy link
Author

sborca commented Nov 14, 2024

Hello!
Thank you for you answer and sorry for my late reply!
So, our config.yml looks like this:

upstreams:
  init:
    strategy: fast
  groups:
    default:
      - localhost
blocking:
  denylists:
    ads:
      - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
      - https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
      - http://sysctl.org/cameleon/hosts
      - https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
  clientGroupsBlock:
    default:
      - ads
  loading:
    refreshPeriod: 24h
    downloads:
      timeout: 60s
    strategy: fast
ports:
  dns: 1053
  http: 4000

The memory resources we have on our router is limited to 120 MB, so some operations like "list refresh" may take some more time (more than 20 seconds) and the browser throws this error.
In our latest tests we discovered that if we modify the value of :

writeTimeout      = 20 * time.Second

from https://github.com/0xERR0R/blocky/blob/main/server/server.go source file, the behaviour changes and the error is not thrown anymore. We set it to 600.
is it possible to make this constant configurable so that we do not need to modify the source code?
Thank you !
PS: attached are the logs we captured during List refresh
blockyLog
browserLog
CORSerr

@TheoTechnicguy
Copy link
Contributor

Thanks for diagnosing the issue further. I agree that moving the value to a configurable setting would be a good idea. The current value could be kept as a default.

@0xERR0R, do you think adding a value in the configuration file would be an acceptable approach to resolve this issue? I'd be happy to have a try at solving it. Do you assign issues? If so, mind assigning it to me?

@0xERR0R
Copy link
Owner

0xERR0R commented Dec 1, 2024

Contributions are always welcome. We don't assign issues, you can just create a PR for this. If you leave the default value as is, it would not change any existing installation. Please also document the new config param in configuration.md file and in docs/config.yml.

@sborca
Copy link
Author

sborca commented Dec 2, 2024

Thank you for your answers! @TheoTechnicguy it would be great if you are willing to create the PR for this issue! Thank you!

TheoTechnicguy added a commit to TheoTechnicguy/blocky that referenced this issue Dec 4, 2024
This commit adds a write timeout configuration parameter. As it is part
of the downloading cycle, it is available under
`blocking/loading/downloads`.
The default value comes from `server/http.go` line 23.

Refs: 0xERR0R#1606
TheoTechnicguy added a commit to TheoTechnicguy/blocky that referenced this issue Dec 4, 2024
0xERR0R added a commit that referenced this issue Dec 17, 2024
* feat(config): read write timeout value

This commit adds a write timeout configuration parameter. As it is part
of the downloading cycle, it is available under
`blocking/loading/downloads`.
The default value comes from `server/http.go` line 23.

Refs: #1606

* feat(server): get write timeout from config

Refs: #1606

* feat(docs): document additional config parameter

---------

Co-authored-by: Dimitri Herzog <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants