Add a new line at the end of the txt report

This PR adds a \n at the end of the txt report. This way you can concat all the reports easily. Or you can do something like wc -l report.txt to count the number of errors that you and not be off by one
Context
This is a real minor thing but I lose 10 minutes today because of this. I was counting the errors of different branches using wc -l report.txt. And I was getting always one error less than expected. This PR will avoid that problem.

Codecov Report

Merging #2255 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@             Coverage Diff              @@
##             master    #2255      +/-   ##
============================================
+ Coverage     81.26%   81.26%   +<.01%
- Complexity     2101     2103       +2
============================================
  Files           348      348
  Lines          6020     6021       +1
  Branches       1102     1103       +1
============================================
+ Hits           4892     4893       +1
  Misses          534      534
  Partials        594      594

Impacted Files
Coverage Δ
Complexity Δ

...itlab/arturbosch/detekt/cli/out/TxtOutputReport.kt
100% <100%> (ø)
6 <0> (+2)
:arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ebff6aa...ce0dcb6. Read the comment docs.


Renaming and auto-indent doesn't work for non-HTML tags

It seems that renaming and auto-indenting on  doesn't work for tags other than the standard HTML tags (<div>, <input>, <h1>, etc). This is only the case if the parent element isn't a standard HTML tag or if it's the root element of the document.
So this works
<html>
    <body>
      <banana> <--- renaming this one works
      </banana>
    </body>
</html>

This doesn't
<banana> <--- renaming this one doesn't work
</banana>

This could very well be caused by my workaround for XML files (#129). Is anyone aware of another way to get Treesitter to work for XML files? Or should we just wait for the XML parser to arrive? (nvim-treesitter/nvim-treesitter#5194)

There are also some cases with proper HTML where renames fail. In both HTML and XML files.
<html>
    <head></head>
    <body>
        <div>  <--- renaming this one works finey
            <div>  <--- renaming this one doesn't work
            </div>
        </div>
    </body>
</html>


Relationship with Outside API Model

I'm curious if this is possible. I'm using EmberFire for my user profile and authentication data, but using Ember Wordpress for all of my content. I have a model from Wordpress called trips and I'd like to give my EmberFire user a hasMany relationship to trips. Is this possible? I keep getting serializer errors and have not seen anything directly related to this in the docs.

I have a project with REST + Firebase and every think works fine to me. What you need to do is create adapter for other kinds of reources.
 ember g adapter modelname


Initialize the logging framework

Choose a open source  log framework as g-blog 's log framework.
1.This framework should have a active community.
2.Not need much log level.
Info,Debug,Error
3.Log Level support dynamic change
This issue is used to track work related to the logging framework.

Based on what I've found so far, it seems that only ZAP supports dynamic logging levels and performs better than other logging frameworks.


Direct download link no longer working correctly

Hello! I have for a while been using the "url" command to add external links that are not supported, specifically GitHub releases in my case. This however seems to have stopped working, as the most recent zip file i have added to the modpack using this method, is just completely empty when exporting.
I then tried to quadruple ensure that the hash and everything was correct, same issue. Then i tried clearing the cache for Packwiz, which resulted in the issue occurring on the other files too (Note that i haven't touched these files at all and they stopped working after clearing the cache). If there is any more info needed, then i will gladly deliver to the best of my ability!
I am on the latest commit (7545d9a)

Same thing happens to jar files.


ContentSecurityPolicy headers overwrite each other

[x] I was not able to find an open or closed issue matching what I'm seeing.
[x] This is not a question. (Questions should be asked on chat (Signup here) or our forums.)

It's often not allowed or recommended to have several headers with the same name. But there are situations where it is allowed or even necessary. The CSP is one of these.
https://w3c.github.io/webappsec-csp/#multiple-policies
and
https://www.w3.org/TR/CSP2/#content-security-policy-header-field
Imagine a case where a main application creates a CSP and different modules also independently add their own CSPs. The framework MUST render them all separately OR do a preemptive union merge which is what the client would otherwise do. It will (hopefully) quickly become standard practice that modules provide their own CSPs.
Code to reproduce the issue
$headers = $controller->getResponse()->getHeaders();
$headers->addHeader(new ContentSecurityPolicy($someDirectives));
$headers->addHeader(new ContentSecurityPolicy($someOtherDirectives));

Expected results
The expected result is a response with two CSP headers (OR a union merged CSP).
Actual results
The second addition overwrites the first, the response only contains that one CSP.

PS: It's not enough to have ContentSecurityPolicy implement MultipleHeaderInterface I think. The framework also needs to make sure to check for existing policies and append them automatically.

Am I even in the right repository? Seems this one hasn't really been touched for quite some time.

Yeah, the repo is correct, but unless someone picks up a failing test case + patch, it's not gonna be solved. If you can manage to create a failing test, that already simplifies things enormously.

Ok, I'll try to find time for something... not that I'm the right person to do that.

Yes you are: you know exactly what the bug looks like 👍


Can you add support for .co2 files

Now that Seamless Co-op has been released it uses .co2 files instead of .sl2 file.
I have to copy it away from the save file rename it to .co2 and then use it, it'll be better if you can add support to it.

+1

.co2 support added


fix: add landmarks and language for screen readers

Added the following to help screen readers:

HTML landmarks
language (english)
Header at the top of the page

Let me know if it looks OK :)
Closes #23

 Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.:x: peterjgrainger sign nowYou have signed the CLA already but the status is still pending? Let us recheck it.


Add coreDir pointing to klasa package

Spoiler alert : transfer command

Actually, because of multiroot, my baseDir and by extension this coreDir needs to be rethought. But I am all for adding a transfer command.

This is no longer needed with my multi-root commit.


Poor explanation - not clear on how to use Adaptive cards to customize search results

Poor explanation, no proper links to Layout designer, and no step by step directions.  I find it very frustrating weeding through the documentation, trying to find a video that hopefully a blogger has posted on the topic that explains the material.  The MS videos are not well explained, maybe because they are done by engineers who live and breathe this topic, and cannot step back and put themselves in the shoes of people who hear for the first time about a new feature/product, etc.

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: ed997b94-55a7-1a7f-ff29-869039a91ce4
Version Independent ID: e95ff5ad-2872-7269-7b8d-ed3221b806cf
Content: Manage search result layouts
Content Source: MicrosoftSearch/customize-results-layout.md
Service: mssearch
GitHub Login: @jypal6
Microsoft Alias: jypal

Hi @vradichkova,
Thanks for your feedback and we will work towards improving the documentation to make the setup simpler. There is an introductory article with steps on customizing result layouts that can be found here - https://docs.microsoft.com/en-us/microsoftsearch/manage-result-types. A video explaining the basic feature setup can be found here - https://youtu.be/jKpIDBalLW0?t=844
Do let us know if this is helpful.

Hope the issue is resolved. Closing this issue as there are no more follow up questions.


Generate defaulter functions

Use https://github.com/kubernetes/code-generator/blob/master/cmd/defaulter-gen, instead of the custom code we have right now to set default values.

Static default values are mostly added to the CRDs themselves now.


OpenLDAP plugin is deficient

The Datadog OpenLDAP plugin is severely deficient and fails to track numerous available metrics from the monitor backend that are critical for end administrators.
For example, it fails to track:
state threads
runqueue threads
tasklist threads

Hi @quanah 👋 , thanks for letting us know about this. I have added a ticket in our backlog to improve the OpenLDAP integration. I'll keep this issue open in the meantime for any updates.

Actually never mind, the 3 thread operations aren't useful and the other operations are tracked by default by the plugin, but not showing up in my specific deployment.


Crash with companion networks on hardhat ^2.16

Describe the bug
When using<EMAIL_ADDRESS>with companion networks configured for non-dev networks, a crash occurs.
This is due to the change of signature of hardhat's createProvider function.
https://github.com/NomicFoundation/hardhat/blob/aebd01983febb777c0e8cca216a3884980128b90/packages/hardhat-core/src/internal/core/providers/construction.ts#L50-L56
Proposed fix #488

Would love to see this merged, as it's currently a blocker for us!

Available in v0.11.43 !


Return a list from BatchScoring

Hi,
is it possible to return a list from a scoring. For example, this is not allowed
 BatchScoring(scoring=lambda x: torch.rand(10,1),
                                        target_extractor=lambda x: x,
                                        name='test',
                                        on_train=True,
                                        lower_is_better=False)

I need to return a list, or at least, append a list to the history in order to get the mean and the max from it. I am evaluating the mean IOU.
Directly append it to the history seems an antipattern, is there any way to add a custom metric without being forced to return one single value?
Thank you

What if I may need the full array in the history? Is it okay to just add the full array?

Yes, this should work:
>>> net.history.record('foo', [1, 2, 3])
>>> net.history[-1, 'foo']
[1, 2, 3]

@FrancescoSaverioZuppichini does this solve your problem?

Yes, thank you :)


Fix tap for the chunked transfer encoding

This PR fixes the issue Daiquri had with TOPCAT. It was impossible to use the TAP_UPLOAD feature because TOPCAT is sending chunked request which was not supported in Daiquiri.
For now I've limited the fix  to the requests sent to  /tap/...  to avoid any surprises for other modules.
One important caveat of this fix - it only works with gunicorn because it provides access to the de-chunked body of the request. It doesn't work with the Django development server and I'm not sure about the compatibility with other servers.
Along with the changes in tap, I refactored some other code:

human2bytes returns only an integer (before it was float, Literal,  None) or raises an exception
make_query_dict_upper_case uses a mutable QueryDict instead of copying the dict. There was an issue with copying if the request was bigger than 2.5 MB.

I'm not 100% happy with the solution since it requires gunicorn but for now I don't have anything better in mind. I'm open to suggestions.

Pull Request Test Coverage Report for Build<PHONE_NUMBER>9
Details

16 of 31 (51.61%)  changed or added relevant lines in 3 files are covered.
No unchanged relevant lines lost coverage.
Overall coverage increased (+0.04%) to 64.007%

Changes Missing Coverage
Covered Lines
Changed/Added Lines
%

daiquiri/tap/middleware.py
5
8
62.5%

daiquiri/core/utils.py
9
21
42.86%

Totals

Change from base Build<PHONE_NUMBER>6:
0.04%

Covered Lines:
4830

Relevant Lines:
7546

💛  - Coveralls

I did some tests and maybe this is not a daiquiri problem after all (although your middleware solution is not bad). I ran daiquiri behind an nginx reverse proxy using a minimal docker setup similar to https://github.com/jochenklar/rdmo-dev-containers/tree/main/nginx-proxy (without the alias) and:
server {
    listen <IP_ADDRESS>:8080;

    server_name nginx.local;

    root /var/www/nginx.local;
    index index.html;

    client_max_body_size 100M;

    location /static {
        proxy_pass http://localhost:9001/;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_pass http://localhost:9000/;
    }
}

The django dev server is running on http://localhost:9000.
Then, I use TOPCAT with http://localhost:8080/tap and the query:
SELECT t.parallax p1, s.parallax p2 FROM daiquiri_data_obs.stars as s join tap_upload.t1 as t on t.id = s.id

(t1 is daiquiri_data_obs.stars queried before).
And in principle it works ... there is another bug in https://github.com/django-daiquiri/daiquiri/blob/dev-formatting/daiquiri/query/utils.py#L204 which need to be changed to:
for upload_column in job.metadata.get('upload_columns', []):

.


Change the way the vote-kick menu works

When playing with a lot of players, people can easily be targeted by players and get vote-kicked. Maybe it's an idea to change the vote-kick menu so that only the host can use it to kick/ban people out of their lobby.

Hello!
This decision is controversial so, if implemented, it needs in-game switch (like an option) which is a lot for a small mod that tries to not conflict with anything else. I'd like to see more possible solutions.
@przebor

Maybe an additional mod that you can install for this feature?

Hello. The subproject has been created
https://github.com/CrowdedMods/CrowdedMod.HostOnlyKick

Awesome!


Install JAVA

Why
Working with terrafrom-nomad-presto module, I have needs to automate table creation process with presto-cli
Presto-cli is jar file
Log
vagrant@vagrant:/vagrant/dev/ansible$ ../../presto_340 --server localhost:8080 --catalog hive --schema default --user presto --file ../../example/resources/query/csv_create_table.sql
../../presto_340: 3: exec: java: not found
vagrant@vagrant:/vagrant/dev/ansible$ which java
vagrant@vagrant:/vagrant/dev/ansible$ echo $JAVA_HOME

vagrant@vagrant:/vagrant/dev/ansible$

Notes
I have successfully tested presto release 340 with openjdk 11.0.8.
openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)

closed, check for status https://github.com/fredrikhgrelland/vagrant-bionic64-ansible-docker/issues/3


obfuscar + .net 7.0

does obfuscar works with .net 7.0 + wpf?
"exited with code 1" doesnt tell anything.
Unable to find assembly:. its there but app cant see it.

Make obfuscar.xml CopyToOutputDirectory to always or if newer. Thats what helped me

Apparently it works with version 7. But there are several  problems with Microsoft.AspNetCore namespaces.
Unable to resolve dependency:  Microsoft.AspNetCore.Mvc.ViewFeatures
Some nuget package was moved to asp.net core 6 framework and now obfuscar could not be find them.
Any solution?

@navidkhalilian this issue is strictly about WPF. For ASP.NET Core issues, please open a new one.

Yes, it does, however you need to supply the SearchPath to the WPF assemblies yourself. And there are some other caveats, for some of them there are already some pull requests.


Ensure const metrics are applied with a lint check

A few metrics that use prometheus.Register were missed in https://github.com/reddit/baseplate.go/pull/555 .  This adds them and adds a lint check to prevent future misses.

Replaced by #559


Error pip install -U doge-datagen

ERROR: Failed building wheel for confluent-kafka
Running setup.py clean for confluent-kafka
Failed to build confluent-kafka
Installing collected packages: confluent-kafka, doge-datagen
Running setup.py install for confluent-kafka ... error

yess thanks :)


Enable index config by default.

This is a bugfix.
As introduced in #10183, each IndexConfig subclass had to manually check for enabled nullability in its own way. It is correct that some indexes may request to explicitly ask for enabled: true in order to be enabled, but all default indexes should be enabled if their config object is present.
For example:
{
   bloom: {
       fpp: 0.02,
   }
}

Should be considered as a enabled config. Even the empty object should be considered enabled
{
   bloom: {
   }
}

In order to explicitly disable an index one must write
{
   bloom: {
       enabled: "false"
   }
}

If the index key is not present or set to null, then the default value will be used. In that case, whether the index is enable or not depends on the index type. For example forward index is enabled by default.
Previous code was erroneously initializing some index configs as disabled, as detected in #10554 for bloom filter. Affected indexes were:

Bloom
Dictionary
H3
FST
Range
Text
Inverted

This PR adds a constructor in IndexConfig that contains the default logic, which is the one all default indexes should use. The PR also add unit tests that verify the correct deserialization of indexes for all index types.

Codecov Report

Merging #10584 (2b1d28e) into master (ea63617) will decrease coverage by 56.49%.
The diff coverage is 0.00%.

@@              Coverage Diff              @@
##             master   #10584       +/-   ##
=============================================
- Coverage     70.39%   13.90%   -56.49%
+ Complexity     6483      439     -6044
=============================================
  Files          2106     2052       -54
  Lines        112882   110405     -2477
  Branches      17001    16703      -298
=============================================
- Hits          79466    15355    -64111
- Misses        27838    93792    +65954
+ Partials       5578     1258     -4320

Flag
Coverage Δ

integration1
?

integration2
?

unittests1
?

unittests2
13.90% <0.00%> (+<0.01%)
:arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files
Coverage Δ

...pinot/segment/spi/index/DictionaryIndexConfig.java
0.00% <0.00%> (-68.19%)
:arrow_down:

...he/pinot/segment/spi/index/ForwardIndexConfig.java
0.00% <0.00%> (-62.00%)
:arrow_down:

...apache/pinot/segment/spi/index/FstIndexConfig.java
0.00% <0.00%> (-66.67%)
:arrow_down:

...ache/pinot/segment/spi/index/RangeIndexConfig.java
0.00% <0.00%> (-87.50%)
:arrow_down:

...pache/pinot/segment/spi/index/TextIndexConfig.java
0.00% <0.00%> (-81.09%)
:arrow_down:

...pinot/segment/spi/index/creator/H3IndexConfig.java
0.00% <0.00%> (-64.71%)
:arrow_down:

...ache/pinot/spi/config/table/BloomFilterConfig.java
0.00% <0.00%> (-68.00%)
:arrow_down:

...org/apache/pinot/spi/config/table/IndexConfig.java
0.00% <0.00%> (-100.00%)
:arrow_down:

...apache/pinot/spi/config/table/JsonIndexConfig.java
0.00% <0.00%> (-86.21%)
:arrow_down:

... and 1653 files with indirect coverage changes
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

Thank you for the awesome test coverage. I'll let others review as well. In case there's some concern with always enabling an index unless the config is exactly "enabled": false, I definitely think the way you did it here is the least surprising for users.

I still think from a user perspective is cleaner to say
{
  bloom: {
    enabled: false
  }
}

Than
{
  bloom: {
    disabled: true
  }
}

But I'm open to change that if other people think like @Jackie-Jiang. What I think that is important is to decide that ASAP. Once people start using enabled it would be more difficult to change it.

One less common example that IMO can lead to surprising behavior is:
{
  enabled: null
}

The above example will actually enable the index

It's surprising, but I think it's still better. If you're configuring an index in any way, you probably already want it on. And if you don't want it on, you're either going to delete the entire block, or explicitly set "enabled": false.
As for enabled vs disabled, was this a new a field, or did it already exist? Because if it existed, wouldn't this be a big breaking change now?

As for enabled vs disabled, was this a new a field, or did it already exist? Because if it existed, wouldn't this be a big breaking change now?

It is newly introduced, and we are debating whether we should explicitly put enabled: false or disabled: true to disable an index. I'm suggesting using disabled: true to disable the index, where disabled: null will be treated as index enabled

I think we can discuss about that, but it shouldn't block this PR. We can merge this to solve the problem and then decide whether we want to change the attribute from enabled to disabled

What happens if we deploy this, then it switches? I guess enabled: false is the only case where the behavior will switch?

That is my concern. The easiest change would be to just ignore the enabled attribute, so:

when enabled was
prev this PR
after this PR
if we use disabled

not defined
sometimes disabled the index
enable the index
enable the index

null
sometimes disable the index
enable the index
enable the index

true
enable the index
enable the index
enable the index

false
disable the index
disable the index
enable the index

Let's move the discussion to https://github.com/apache/pinot/pull/10585


The hardhat-zksync-solc complie is to large than solidity 0.8.19

zksolc: {
version: "latest",
compilerSource: "binary",
settings: {
optimizer: {
enabled: true, // optional. True by default
mode: 'z', // optional. 3 by default, z to optimize bytecode size
runs: 200
},
},
},
solidity: {
version: "0.8.19",
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
},
using zksolc complied size is 58.406 KB
using solidity compiled size is 18.924 KB

Hey @tiantianlikeu! I noticed you've been comparing the outputs of solc and zksolc, and it seems that zksolc's compiled size output is indeed bigger. However, based on the comments you added in the optimizer config section, it's clear that you're specifically interested in comparing outputs when the mode is set to 3 or z. So make sure to focus on those configurations for a more accurate comparison.

@mpopovac-txfusion  Hey ! I want them to be about the same size, how to optimize the configuration, I looked at the documentation, zksolc optimizer is already z.
help me


Thanos Sidecar heartbeat failed due to "context deadline exceeded"

Is your proposal related to a problem?

The Thanos Sidecar container fails its heartbeat against Prometheus with the messages:
 level=warn ts=2021-04-29T12:58:27.849316431Z caller=sidecar.go:180 msg="heartbeat failed" err="perform GET request against http://<IP_ADDRESS>:9090/api/v1/status/config: Get \"http://<IP_ADDRESS>:9090/api/v1/status/config\": context deadline exceeded"
 level=warn ts=2021-04-29T12:58:57.84932781Z caller=sidecar.go:180 msg="heartbeat failed" err="perform GET request against http://<IP_ADDRESS>:9090/api/v1/status/config: Get \"http://<IP_ADDRESS>:9090/api/v1/status/config\": context deadline exceeded"
 level=warn ts=2021-04-29T12:59:27.84938737Z caller=sidecar.go:180 msg="heartbeat failed" err="perform GET request against http://<IP_ADDRESS>:9090/api/v1/status/config: Get \"http://<IP_ADDRESS>:9090/api/v1/status/config\": context deadline exceeded"
 level=warn ts=2021-04-29T12:59:57.849164466Z caller=sidecar.go:180 msg="heartbeat failed" err="perform GET request against http://<IP_ADDRESS>:9090/api/v1/status/config: Get \"http://<IP_ADDRESS>:9090/api/v1/status/config\": context deadline exceeded"
 level=warn ts=2021-04-29T13:00:27.849479648Z caller=sidecar.go:180 msg="heartbeat failed" err="perform GET request against http://<IP_ADDRESS>:9090/api/v1/status/config: Get \"http://<IP_ADDRESS>:9090/api/v1/status/config\": context deadline exceeded"
 level=warn ts=2021-04-29T13:00:57.849291086Z caller=sidecar.go:180 msg="heartbeat failed" err="perform GET request against http://<IP_ADDRESS>:9090/api/v1/status/config: Get \"http://<IP_ADDRESS>:9090/api/v1/status/config\": context deadline exceeded"
 level=warn ts=2021-04-29T13:01:27.849379989Z caller=sidecar.go:180 msg="heartbeat failed" err="perform GET request against http://<IP_ADDRESS>:9090/api/v1/status/config: Get \"http://<IP_ADDRESS>:9090/api/v1/status/config\": context deadline exceeded"
 level=warn ts=2021-04-29T13:01:57.849290597Z caller=sidecar.go:180 msg="heartbeat failed" err="perform GET request against http://<IP_ADDRESS>:9090/api/v1/status/config: Get \"http://<IP_ADDRESS>:9090/api/v1/status/config\": context deadline exceeded"
 level=warn ts=2021-04-29T13:02:27.849238919Z caller=sidecar.go:180 msg="heartbeat failed" err="perform GET request against http://<IP_ADDRESS>:9090/api/v1/status/config: Get \"http://<IP_ADDRESS>:9090/api/v1/status/config\": context deadline exceeded"

The heartbeat is configured to check against Prometheus' endpoint at /api/v1/status/config every 30s. A timeout will occur already after 5s (see https://github.com/thanos-io/thanos/blob/main/cmd/thanos/sidecar.go#L188).
This 5s-timeout is not enough in our setup, as the response from Prometheus always takes more time. From inside thanos-sidecar:
/tmp $ time wget http://<IP_ADDRESS>:9090/api/v1/status/config
Connecting to <IP_ADDRESS>:9090 (<IP_ADDRESS>:9090)
saving to 'config'
config               100% |********************| 6845k  0:00:00 ETA
'config' saved
real	0m 24.15s
user	0m 0.00s
sys	0m 0.01s

Describe the solution you'd like

I think it would be good to separate the UpdateLabels and heartbeat functionality. Heartbeat could use Prometheus' /-/ready endpoint and UpdateLabels could not define a timeout.
Describe alternatives you've considered

Alternatives could be:

have Prometheus respond with its config within < 5s
have a configurable timeout duration for the heartbeat/UpdateLabels

Additional context

(Write your answer here.)

I understand your issue and the described solutions make sense in such case. However I think the core issue here is the response time of your Prometheus. Do you have any idea why it takes 24(!!) seconds? :)
I've done a check myself and my status/config is only 50 times smaller. Yet this takes 0.02s.
So it's not like your config file is that huge, at least not to explain the 24s request time. Have you any idea why this is happening? Any chance you could share your config?

After refactoring our ServiceMonitor objects (thanks to https://github.com/prometheus/prometheus/issues/8014) and therefore reducing the number of scrape jobs (config size now at 2285k), the CPU usage dropped from ~30 cores to ~7 cores. Prometheus' response time of the config endpoint currently is < 0.5s. The mentioned "heartbeat failed" problem is therefore fixed.
Thanks @wiardvanrij for pointing me in the right direction of the root cause :)
I will close this issue as no change is needed in the Thanos source code.

Why not use /-/ready ?

Why use UpdateLabels to check prometheus is up ?  Is UpdateLabels need to do very often ?
Sometime, we can't avoid  a huge prometheus config , I don't think it is good to setup a big vault for get_config_interval and get_config_timeout because I need a sensitive  alert
I think heartbeat should be a very tiny data health check , "GET" is totally good . It shouldn't   anything on config.


Add perf test suite

Could we do like this instead:
Automatically copy (similar to how we do with test-compat) node_modules/bipf/test/perf.js and node_modules/bipf/package.json to a folder in our project, and git ignore those. Run the same perf.js as what bipf has. If you need to make adaptations to the original files, then just make a PR to bipf, and I can merge it over there.

Will do.
BTW it allowed me to notice that zig encode is reeeeaaal slow (8 times slower).
No idea so far why.

Wow, that's a lot slower. Yeah, I'm also curious to tweak the performance.


Add Link Analysis functions

What is the expected enhancement?
Add functions to calculate PageRank and HITS to expand the retworkx's link analysis capabilities.
These algorithms are popular among users of graph libraries, and also appear frequently in benchmarks. The hope by adding those algorithms is to make retworkx appeal to more users and become more popular.
For inspiration, our functions couls have an API that is similar to networkx's Link Analysis API:

pagerank
pagerank_numpy
hits
hits_numpy

What about google_matrix, hub_matrix, and authority_matrix looking at those it looks like they're used internally by the functions you listed but also exposed as public functions in networkx. Do you think it makes sense to do the same for retworkx?

What about google_matrix, hub_matrix, and authority_matrix looking at those it looks like they're used internally by the functions you listed but also exposed as public functions in networkx. Do you think it makes sense to do the same for retworkx?

It would be nice to expose those publicly if it is easy to do so. It also helps to keep the code organized, so we could follow networkx implemenation style and separate it as calculate matrix in one function, than interpret the eigenvectors in another function.
However, the main focus should be implementing pagerank and hits. google_matrix and hub_matrix would be a nice to have, but pagerank and hits are an order of magnitude more popular than the internals they use. For link anaylsis, what matters is more the end result.


R cleanup

Adds tests, license, linting, docs, etc. so that there is a clean devtools::check() from R.

@ronichoudhury, if you'd like to check for me, in R perform:
setwd('path/to/candela/R/candela')
install.packages('devtools')
devtools::check() # Should produce no errors, warnings, or notes
devtools::test() # Should pass simple no-error test and linting test
devtools::install()
w <- candela::candela('ScatterPlot', data=mtcars, x='disp', y='mpg')
htmlwidgets::saveWidget(w, 'out.html') # Should be able to open out.html in browser

This also enables CDN-ed candela so we don't need a copy of Candela in the R package. I do this by adding a script tag with the CDN candela dynamically, then on render() waiting for window.candela to appear before rendering the widget.

devtools::test() failed with this message: Error in (function (dep_name, dep_ver = NA, dep_compare = NA) : Dependency package htmlwidgets not available. I fixed it by doing install.packages('htmlwidgets') but it seems like this should have been done in a previous step automatically?

This is just an issue with the order of my instructions. If you had done devtools::install() before devtools::test() it should work. You can verify by doing remove.packages('htmlwidgets') then doing the steps in the this order.

htmlwidgets::savewidget() failed because I didn't have pandoc installed; once I took care of that with my OS package installer, it worked beautifully. Does the requirement on a system pandoc need to be documented? Do you know why pandoc is needed in the first place?

Interesting. When I do it from RStudio pandoc is not required. When I do it from a console, it says pandoc is required. I'm guessing RStudio bundles in pandoc. It's clearly required for the selfcontained option, as you can see here:
https://github.com/ramnathv/htmlwidgets/blob/master/R/savewidget.R
https://github.com/ramnathv/htmlwidgets/blob/master/R/pandoc.R
This page explains things somewhat:
https://github.com/rstudio/rmarkdown#installation
I can add a blurb about this in the main documentation.

Doing the install before the check and test works.
The check shows a "note": Package suggested but not available for checking: ‘lintr’. Is that a big deal?

I went down the rabbit hole a bit more on the different dependency specifications in R. "Imports" deps are always installed, while "Suggests" deps are only installed when the option dependencies=TRUE is passed to devtools::install() or install.packages(), and it appears that for check to pass, the "Suggests" packages must be installed. Hence the reason that people say the suggestions are Mafia-style "suggestions you can't refuse", see https://stat.ethz.ch/pipermail/r-devel/2007-April/045229.html.
I'll document how to do the steps in the right order with the right arguments in the docs :)

I've updated the R install docs to be clearer on dependencies=TRUE and the installation of pandoc. Ready for review.

Current coverage is 58.19% (diff: 100%)

Merging #413 into master will not change coverage

@@             master       #413   diff @@
==========================================
  Files            26         26
  Lines           708        708
  Methods           0          0
  Messages          0          0
  Branches          0          0
==========================================
  Hits            412        412
  Misses          296        296
  Partials          0          0

Powered by Codecov. Last update 8fd777f...b3da9f1

@jeffbaumes can we delete this branch too?

Yes, done.


mom6 grid is different in soca and r2d2 data

Description
mom6's data grid is different in soca and r2d2. Looking at the MOM.res.nc file in here https://github.com/JCSDA-internal/soca/tree/develop/test/Data/72x35x25,  the longitude is between -280 and 80

while looking the the mom6 data in r2d2, Longitude is between -300 and 60

because NOBM data's longitude is between -280 and 80, we have a bug in oasim hofx results.

@HamidehGMAO FYI, when remapping you'll want to use the lon and lat variables from
/discover/nobackup/projects/jcsda/s2127/static/skylab-8.0.0/soca/025deg/soca_gridspec.nc and /discover/nobackup/projects/jcsda/s2127/static/skylab-8.0.0/soca/5deg/soca_gridspec.nc

I see! Thanks @travissluka.


MAINT xfail the fetch_movielens test

this test if causing the CI to fail due to a download error. here also, (as for the ken embeddings) the real fix is to mock doownloads in tests but in the meanwhile this allows the ci to run @glemaitre

also fix the unbound local variable error


Feature - Allow for layouts to have different CSS files via prefix workflow, enables you to have different/multiple template styles in same project

allows for layouts to have different css references but page names
prefix must match css file name
e.g.

scss/__invite.scss
.invite { background-color:#333333; ... }
...
scss/invite.scss
@import 'settings';
@import 'foundation-emails';
@import '_invite';
...
layouts/invite.html
...

...
pages/invite.html, invite2.html, invite_audience1.html
/---
layout: invite
/---
...

So all the pages with the prefix "invite" will be inlined with the css
from invite.css

Hey Billy, sorry for the delay, I implemented the fix but the syntax you gave me was a little off; probably cos my fork is a few commits behind but I managed to get it working ;)

Sweet thanks man! I’ll check it out soon.

On Dec 20, 2016, at 4:04 PM, Andrew Quan<EMAIL_ADDRESS>wrote:
Hey Billy, sorry for the delay, I implemented the fix but the syntax you gave me was a little off; probably cos my fork is a few commits behind but I managed to get it working ;)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/zurb/foundation-emails-template/pull/25#issuecomment-268359179, or mute the thread https://github.com/notifications/unsubscribe-auth/AFWRlhfYuV1WrvForXiqQwIhM1UYnXLdks5rKELMgaJpZM4JuSZ7.

I tested out the latest updates and noticed that this new templating setup will only work with the npm run build terminal command and it breaks using the npm start command. Can you update the file to make this work for the npm start command too?

Sorry for the delayed update Billy; my dad passed away about 2 weeks ago.

...added an index generator.

Dude, I’m so sorry to hear that man! I hope you and your family are doing ok and I send my condolences.
Definitely not a worry with timing. I’m just providing some comments and I appreciate your help with this too : ) I’m still new to using github’s features, and not sure If I can provide updates as well, but I’m busy myself with tons of things too. I can help out if you ever need and thanks again for your help with this!

On Jan 23, 2017, at 11:27 AM, Andrew Quan<EMAIL_ADDRESS>wrote:
Sorry for the delayed update Billy; my dad passed away about 2 weeks ago.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/zurb/foundation-emails-template/pull/25#issuecomment-274537030, or mute the thread https://github.com/notifications/unsubscribe-auth/AFWRlsjdBAs7rZMwuukJU97uDdVwZ-Ymks5rVNUOgaJpZM4JuSZ7.

I was able to create a workflow for multiple template styles within one project with very minimal effort or change to the original repo.
I simply edited the gulpfile to look for all scss files, and within subfolders as well, meaning you create in assets/scss/template/[custom sass file].
This file now compiles to dist/css/template/[custom compiled css file].
Then I utilized the layouts folder to create different layouts that pull in the custom css file. I took the default layout and turned the start of the html and the end into partials (template-start.html and template-end.html). These look like this (make sure to look at the css linking path and see {{type}}:
template-start:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<link rel="stylesheet" type="text/css" href="{{root}}css/{{type}}.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width">
<title>{{subject}}</title>


Importing and creating a stateful actor and overriding receive gives error

Getting a receive has incompatible type compile error when using the code from the Test Suite directly to the run method

Today encountered same issue. Examples from tests aren't compiling.

@akilegaspi Hi, the examples from tests are compiling and running correctly with the latest version! 🙂
@softinio Should we close this?

I haven't actually tried it again since I was waiting for some updates to the repository but I'll be trying it now and give a report!

Nevermind, I think this should be closed already.
Thank you for your contribution @mtsokol !

Yup closing 👍


Getting 'Cross-Origin Request Blocked' on a GET request

#### Summary
I'm making a GET request to 4chan's API for retrieving threads from a board. This is my code:
const board = this.props.routeParams.tag;
var config = {
    headers: {'Access-Control-Allow-Origin': '*'}
};
axios.get('https://a.4cdn.org/' + board + '/threads.json', config)
    .then(function (response) {
        console.log(response.data);
});

I receive the following warning:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://a.4cdn.org/a/threads.json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
As seen above, I have added the relevant header, but it does not solve the issue. I made the same request from my terminal using cURL and it worked fine.
#### Context

axios version: e.g.: v0.16.0
Environment: e.g.: node v6.9.4, Firefox 51.0.1, Ubuntu 14.04

cURL does not enforce CORS rules. Those rules are enforced by browsers for security purposes.
Also, when you mention that you added the relevant header, I assume you mean you added those headers to the request. Actually, the header is expected in the response headers from the server, indicating that the resource is allowed to be accessed by other websites directly.
FYI, CORS - Cross Origin Resource Sharing. Since your API does not support it, you have two options -

Use a proxy server on the same domain as your webpage to access 4chan's API or,
Use a proxy server on any other domain, but modify the response to include the necessary headers.

I'd like to vote to close this issue as "Not an issue".

Thank you for the suggestion. I have updated my code to route the request through a proxy:
axios.get('https://a.4cdn.org/a/threads.json', {
	headers: {
	  'Access-Control-Allow-Origin': '*',
	},
	proxy: {
	  host: '<IP_ADDRESS>',
	  port: 3128
	}
	}).then(function (response) {
		console.log('response is : ' + response.data);
	}).catch(function (error) {
		if (error.response) {
		  console.log(error.response.headers);
		}
		else if (error.request) {
	      console.log(error.request);
		}
		else {
		  console.log(error.message);
		}
	console.log(error.config);
});

However, I'm still getting this error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://a.4cdn.org/a/threads.json. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://boards.4chan.org’).

I have searched through various forums and questions on Stack Overflow and I can't seem to find any solution to this. It would be appreciated if someone could provide some insight.

Any news on this? I'm pretty much in the same boat...

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://a.4cdn.org/a/threads.json. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://boards.4chan.org’).

This is because https://a.4cdn.org and https://boards.4chan.org are different domains. The difference is in a and boards

I'm also getting same issue. Can anyone please help me on this

saaaaame

As a temporary solution you can use this : https://chrome.google.com/webstore/detail/cors-toggle/omcncfnpmcabckcddookmnajignpffnh

@PetitBateau I'm not sure how the Chrome extension would help sending requests through axios.

It did the trick for me ;)

A Chrome extension helps only for those who have the extension. Depending on Chrome extension in production is not a good idea, as not everyone has that extension.

That's why i said it was a temporary solution. And of course for a deve environment.

Access-Control-Allow-Origin is a response header, not request header:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
axios.get(url, { headers: {'Access-Control-Allow-Origin': *} } ) means nothing!
try
axios.get(url, { crossdomain: true })

@ronnin For the record, I tried your solution out, but it doesn't work.

The remote api service to which you are making your AJAX request does not accept cross origin AJAX requests from your website domain. One thing you could do if you have access to your website server-side codebase, is to create a controller action there (assuming you are using an MVC) and then use it to consume the remote service. You can then make AJAX requests to your controller action. A bonus to this approach is that you could run additional checks before contacting the remote api, formatting its response and even caching it.

Read this, everyone.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

i always find reference to that MDN document not very helpful. its a long document and it doesnt directly address the question at hand. what do i do if i dont have access to the server side codebase and want to access this API?

My solution is to create my own api on my domain server to access any foreign api that doesnt allow cross-origin requests, I call it my repeater api.

@JigzPalillo Can you share the approach or code? I'm pretty much stuck! :(

Normally this would work, but in the case that it doesn't and you don't have any access to that domain...
axios.get('https://www.notmydomain.com/1511.json')
    .then(function (response) {
        console.log(response.data);
});

What I did was create a repeater on my server
axios.get('https://www.mydomain.com/repeater.php?url=https://www.notmydomain.com/1511.json')
    .then(function (response) {
        console.log(response.data);
});

/* repeater.php */
function collect_data($url){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //remove on upload
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_AUTOREFERER, false);
    curl_setopt($ch, CURLOPT_REFERER, "https://www.notmydomain.com");
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    $result = curl_exec($ch);
    echo curl_error($ch);
    curl_close($ch);
return($result);
}
echo collect_data($_GET["url"]);

The server needs to respond with CORS headers on the options call.  If you are using nodejs/express, you can fix this for all endpoints with:
app.use(function(req, res, next) {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
  next();
});

But that's a little loose.  Probably want to tighten up for production.

I have long solved that problem though. The server belongs to a 3p service and therefore out of my control. I simply proxied it instead. All is well on that front.
Thanks

@steveswork same here, server belongs to a 3p service, pretty sad that I can use ajax, request.js but not axios which i prefer 👎

@adl1995 do happen to be able to fix this problem yet? I totally confuse how to handle this error

if use Laravel, addition function:

header('Access-Control-Allow-Origin: *');

to controller before return
Example:
Route::get('post',function(){     $get = Blog::all();     header('Access-Control-Allow-Origin: *');     return $get; });
Sorry for my English. Hope this can help you.

I use vue.js (localhost port 8080 ) and Flask for my API (localhost port 5000)
I simply had to make small change in  my api code .
I added flask extension flask-CORS and modified my code to use it.
Before:
from flask import Flask, request
import json
app = Flask(__name__)

After:

from flask import Flask, request
import json
from flask_cors import CORS
app = Flask(__name__)
CORS(app)

After this it worked and I could use my API.

By setting the headers and proxy options, I got instead the Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource..
But I was able to get around that with this extension: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en .
Sadly, that worked only yesterday and not today...I've been trying to figure out the hell why

Proxy requests using Webpack dev server to avoid cors in development mode
In your webpack.config file add
"devServer":{
  "proxy": {
    "/api": {
    "target": 'https://my-target.com',
    "pathRewrite": { '^/api': '' },
    "changeOrigin": true,
    "secure": false
    }
  }
}

The above example will proxy the request
axios.post(/api/posts/1 ... . . . .
to https://my-target.com/posts/1
The above Git example, u need to change like this in your request
axios.get('/api/a/threads.json', {
	headers: {
           //  if u have some headers like this
	   //  'Authorization': ' Basic //////some values'
	},
	}).then(function (response) {
		console.log('response is : ' + response.data);
	}).catch(function (error) {
		if (error.response) {
		  console.log(error.response.headers);
		}
		else if (error.request) {
	      console.log(error.request);
		}
		else {
		  console.log(error.message);
		}
	console.log(error.config);
});

In webpack.config file ........
"devServer":{
  "proxy": {
    "/api": {
    "target": 'https://a.4cdn.org',
    "pathRewrite": { '^/api': '' },
    "changeOrigin": true,
    "secure": false
    }
  }
}

the modified webpack config proxy will change your request like this..
u can see this in chrome dev tool REQUEST HEADERS
https://a.4cdn.org/a/threads.json

u can use multiple paths in devServer proxy like this
In webpack.config file ........
"devServer":{
  "proxy": {
    "/api": {
    "target": 'https://a.4cdn.org',
    "pathRewrite": { '^/api': '' },
    "changeOrigin": true,
    "secure": false
    },
    "/login": {
    "target": 'https://github.com', // for example
    "pathRewrite": { '^/login': '' },
    "changeOrigin": true,
    "secure": false
    },
    "/post": {
    "target": 'https://facebook.com', // for example
    "pathRewrite": { '^/post': '' },
    "changeOrigin": true
    }
  }
}

Use if u need
    "changeOrigin": true,
    "secure": false

I spent hours to fix it and seems like no help everywhere. the simple and fast way is to add a chrome extension called Allow-Control-Allow-Origin*.  https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en

will help only you, but how about other people?

Somehow useful: https://github.com/shalvah/cors-escape

trying Vue and axios I obviously got the same issue.
Just tried the solution provided by sundar6445 and it works perfectly.
The webpack config file I modified is in /config/index.js. I prefered to modify this one since referenced in /build/webpack.dev.conf.js
In it you find
module.exports = {
  dev: {
...
proxyTable: {},

As described by sundar, change the proxyTable by for instance something like
proxyTable: ({
      '/events': {
        "target": 'http://localhost:3000',
        "changeOrigin": true,
        "secure": false
      }
    }),

which means that everything starting by /events will be routed to http://localhost:3000/events. No 'pathRewrite' in my case, relative url will be the same.
and of course, don't forget to remove the full URL in your Vue component. I had:
  mounted () {
    axios.get('http://localhost:3000/events/nb')
      .then(result => {
        this.new_et_nb = result.data
        console.log('*******' + JSON.stringify(result) + ', ' + result.data)
      }, error => {
        console.error(error)
      })
  }

it becomes:
  mounted () {
    axios.get('/events/nb')
      .then(result => {
        this.new_et_nb = result.data
        console.log('*******' + JSON.stringify(result) + ', ' + result.data)
      }, error => {
        console.error(error)
      })
  }

and it works perfectly well. Thanks to @sundar6445
Hope this helps

I know this is marked closed, but I wanted to point something out. Sometimes this error will appear on the client side if your API Key is either expired or being used by someone else.
This might go without saying of more experienced developers but for those people new to coding, make sure you have a unique API Key. Not all APIs require unique keys, but if they do, you will certainly need it. Refer to the API documentation for your specific API to see what they require.

There is no option as crossDomain inside the Axios. Please study the source-code before giving/using wrong clues.

You cannot execute JavaScript to retrieve information from another site. This is to prevent you from gaining access to a client's browser and potentially draining their bank accounts or posting to some site without their permissions. The same goes for scraping sites (which is essentially what the op is trying to do).
You can scrape the web (i.e., fetch data) using a server with a CORS module, and proxy via that server.

I this header config will solve this issue.
headers: { 'content-type': 'application/x-www-form-urlencoded' }
Thanks

I know this sounds cliche, but my solution to this problem has been creating a custom api to handle this calls.

The problem is not with axios. The issue is with the server. When you serve up data you must add the following headers, before sending it.
Access-Control-Allow-Origin must be set to *
Access-Control-Allow-Headers must be set to Origin, X-Requested-With, Content-Type, Accept

Source : CORS error while making axios.get call
Referring to these answer, i added this simple line to my backend express server, "Access-Control-Allow-Origin", "http://<IP_ADDRESS>:8080", like so :
app.use(function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "http://<IP_ADDRESS>:8080");
    next();
});`

source : CORS on ExpressJS
And everything works fine for me, without any additional configuration on axios or in the frontend, so it's really not an axios problem but a lack of server side header configuration.

if you want to fetch data from a third party api or url that has a issue with its CORS header(missing or contains multiple values) I think the only solution for this is use the project
"https://cors-anywhere.herokuapp.com/"
I use the link for small projects but for big projects you may want to create your own api to handle the calls and creating the api you can use the open source project https://github.com/Rob--W/cors-anywhere/ .
This one will work:
axios.get(`${'https://cors-anywhere.herokuapp.com/'}https://a.4cdn.org/a/threads.json`)
.then(res => {
  console.log(res)
})

I bumped into this problem some time ago while creating 4webm and 4chan-list-webm
It's worth noting that if you make a browser plugin, you don't need to play with the headers to hit the API. Maybe if we summon @moot he'll enable CORS :smile:

crossdomain: true

I had to enable the port '8080' on the backend CORS and it then worked.

secure

webpack documentation to a better understanding: https://webpack.js.org/configuration/dev-server/#devserver-proxy

If you are using laravel or lumen for your backend API. And you are using barryvdh/laravel-cors package already. The solution is to set your cors.php config as the header, method and origin part as this
'allowedOrigins' => ['*'],     'allowedHeaders' => ['*'],     'allowedMethods' => ['*'],
Hopefully it solves someone's issue

If you do it in safari it takes no time, Just enable the developer menu from Preferences >> Advanced, and select "Disable Cross-Origin Restrictions" from the develop menu. If you want local only, then you only need to enable the developer menu, and select "Disable local file restrictions" from the develop menu.
and in Chrome for OSX open Terminal and run:
$ open -a Google\ Chrome --args --disable-web-security --user-data-dir

--user-data-dir required on Chrome 49+ on OSX

For Linux run:
$ google-chrome --disable-web-security
Also if you're trying to access local files for dev purposes like AJAX or JSON, you can use this flag too.
-–allow-file-access-from-files
For Windows go into the command prompt and go into the folder where Chrome.exe is and type
chrome.exe --disable-web-security
That should disable the same origin policy and allow you to access local files.

Tried all the solution mentioned above. nothing works.
finally found one - https://github.com/expressjs/cors
i hope it helps you guys

The main issue is the difference between server requests and client requests.
When you're making requests via the client (aka most of the time, a browser) you are at the mercy of the browser software. The standard for browser software is to prevent any attempts at malicious activity that may or may not come from your own software.
If you are making a request from your own server (aka not a browser client), then the given is that for the code you have written yourself, no one (depending on your server settings) can access nor control it, and you know what kinds of requests are outgoing so there are no concerns for network calls occurring outside of your environment or your knowledge.
That's why browsers are strict about cross origin requests, specifically since once your public code is on the client, you have less control over who sees it / who can manipulate it. In the case that your frontend application is compromised and some malicious software is able to conduct network calls off your code at the expense of your visitors/users, they want to ensure that it cannot happen. Therefore, your mydomain.com cannot make calls to allyourdataarebelongtome.com just in case you didn't mean for it to happen.
The solution here is not that cross domain requests are not working - it's that either that you own server is preventing this needs to accept your domain and you need to accommodate this circumstance, or that the third party server you're trying to make API calls to has some other method of authentication/authorization on top of that cross domain request.

I think this header config will solve this issue.
headers: { 'content-type': 'application/x-www-form-urlencoded' }
Thanks

Thanks. Solved for me.

From here : https://github.com/axios/axios I've realized that they doesn't put full url to axios url request.
So I try and solved this by creating my own API on my site. I just sent request like this
axios.get('/sample/request')
then http://<IP_ADDRESS>:8080/sample/request will send another request to https://a.4cdn.org/ and return responses to axios as json.
hope it can help you

As I understand the problem is that request is sent from loclahost:3000 to loclahost:8080 and browser rejects such requests as CORS. So solution create the proxy and browser will handle requests as they are gone from one server.
Correct me if I'm wrong
My solution was :
import proxy from 'http-proxy-middleware'
app.use('/api/**', proxy({ target: "http://localhost:8080" }));

I was with the same problem and I solve it installing 'cors' in my backend (Express).
Run:
npm install cors
Then just set this:
var cors = require('cors');
app.use(cors());

Thank's @ernandoruch, this is working with my nodejs server

I had same problem and solved it
app.use((req, res, next) => {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
  next();
});

worked at first, but then it stopped and i couldnt figure out why.
then I realized that I moved all my code to another file so I need to use router :
router.use((req, res, next) => {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
  next();
});

Hi,
Any update on this issue, I'm using .net core 2.1 and axios 0.18.
Thanks.

I don't think the issue is in axios, the issue is in your back-end server.
For me I have an architecture with Flask on back-end and using axios in Vue.JS, only thing I had to do on my Flask server is:
...
from flask_cors import CORS
...
CORS(app)

This shouldn't go to production though, you can also have a cross origin allow list at the nginx level. I read through this, might be helpful.

As a temporary solution you can use this : https://chrome.google.com/webstore/detail/cors-toggle/omcncfnpmcabckcddookmnajignpffnh
I did not find anything better for now ..

Bad idea

import axios from 'axios'
import jsonpAdapter from 'axios-jsonp'

axios.get(`${url}`, { adapter: jsonpAdapter })
        .then(result => {
            console.log('Status Code: ' + result.status)
        })
        .catch(error => console.log('Request failed'))

JSONP (JSON with Padding or JSON-P) is used to request data from a server residing in a different domain than the client. JSONP enables sharing of data bypassing same-origin policy.

I just use jquery's $.get for external api calls.

if you want to fetch data from a third party api or url that has a issue with its CORS header(missing or contains multiple values) I think the only solution for this is use this link
"https://cors-anywhere.herokuapp.com/"
I use the link for small projects but for big projects you may want to create your own api to handle the calls and creating the api you can use the open source project https://github.com/Rob--W/cors-anywhere/ .
 Cheers - i've followed many trails across the web in search of a solution and yours is the first that has worked for my particular scenario.

I just came a cross this issue. I had {withCredentials: true} (a copy and paste from my other API) for this particular 3rd party API to work I simply had remove {withCredentials: true}

This solution work for me
axios.get(myurl, {
    crossDomain: true
}).then(res => {
    console.log(res);
}).catch(error => {
    console.log('error', error);
})

reference https://stackoverflow.com/questions/42422494/cross-domain-at-axios

if you want to fetch data from a third party api or url that has a issue with its CORS header(missing or contains multiple values) I think the only solution for this is use this link
"https://cors-anywhere.herokuapp.com/"
I use the link for small projects but for big projects you may want to create your own api to handle the calls and creating the api you can use the open source project https://github.com/Rob--W/cors-anywhere/ .
This one will work:
axios.get(`${'https://cors-anywhere.herokuapp.com/'}https://a.4cdn.org/a/threads.json`)
.then(res => {
  console.log(res)
})

Extraordinary it works !!!

we encountered this issue as well when switching to axios
our setup is webpack + devServer (with proxy) + axios
the problem was that we used our full api url as baseURL in axios instead of just '/api' (the proxy does the mapping via the target attribute)

In my opinion this might be due to our own mistakes. I am experiencing the same problem as above. 2 days I took the time to look for this problem. it turns out it's just a small problem that I found. the url address I entered is not in accordance with the parse documentation. and now axios works perfectly on my angular 7

Check if the flask or other server has CORS enabled .
Also check if the server address is correct .I was stuck just because i forgot to add the port of the server .
axios.get('http://localhost:5000/jsonshow')
.then(response => (this.array= response))

{{array}}

Change "localhost:3000" to "http://localhost:300" work fine with me(make sure enable cors at serverside)

Change "localhost:3000" to "http://localhost:300" work fine with me(make sure enable cors at serverside)

if you are running on port 300 and not 3000.

in VueJS you can create a vile called vue.config.js at the root of the project if it doesn't exist and add something like
module.exports = {
  devServer: {proxy: 'http://localhost:3000'}
}

Then your Axios call should look like
axios.get('/api/say_hello', {})

if you want to fetch data from a third party api or url that has a issue with its CORS header(missing or contains multiple values) I think the only solution for this is use this link
"https://cors-anywhere.herokuapp.com/"
I use the link for small projects but for big projects you may want to create your own api to handle the calls and creating the api you can use the open source project https://github.com/Rob--W/cors-anywhere/ .
This one will work:
axios.get(${'https://cors-anywhere.herokuapp.com/'}https://a.4cdn.org/a/threads.json)
.then(res => {
console.log(res)
})

This one worked for me! Thanks!

`
import Vue from 'vue';
import App from './App.vue';
import router from './router';
import axios from 'axios';
Vue.config.productionTip = false;
// 不能设置为 true
axios.defaults.withCredentials = false;
axios.defaults.proxy = {
host: 'http://localhost',
port: 5000,
};
new Vue({
router,
render: (h) => h(App),
}).$mount('#app');
`

`import Vue from 'vue';
import App from './App.vue';
import router from './router';
import axios from 'axios';
Vue.config.productionTip = false;
// 不能设置为 true
axios.defaults.withCredentials = false;
axios.defaults.proxy = {
host: 'http://localhost',
port: 5000,
};
new Vue({
router,
render: (h) => h(App),
}).$mount('#app');
`

Try this one :
import Vue from 'vue';
import App from './App.vue';
import router from './router';
import axios from 'axios';

Vue.config.productionTip = false;

// ======================
axios.defaults.withCredentials = false;
axios.defaults.proxy = {
  host: 'http://localhost',
  port: 5000,
};
// ======================
new Vue({
  router,
  render: (h) => h(App),
}).$mount('#app');

if you want to fetch data from a third party api or url that has a issue with its CORS header(missing or contains multiple values) I think the only solution for this is use this link
"https://cors-anywhere.herokuapp.com/"
I use the link for small projects but for big projects you may want to create your own api to handle the calls and creating the api you can use the open source project https://github.com/Rob--W/cors-anywhere/ .
This one will work:
axios.get(`${'https://cors-anywhere.herokuapp.com/'}https://a.4cdn.org/a/threads.json`)
.then(res => {
  console.log(res)
})

Saving my time,  thank you a lot!

@ronnin For the record, I tried out your solution, but it doesn't work.

What? Really? For me it definitely worked...
For the GET method, works like a charm!
Here is the example I made using a public API, based on @ronnin comment:
        axios.get('https://world.openfoodfacts.org/api/v0/products', { crossdomain: true })             .then(function (response) {                 console.log(response.data);         })

it's 2019 now, is there any update? 😃

i use this chrome extension for develop my app
https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi

@ronnin For the record, I tried out your solution, but it doesn't work.

Men, who are in trouble, are not well acknowleged with CORS, and should read the article @seungha-kim mentioned earlier: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
As summary:

remote resources you requested, if not on the same host with request from (origin), must provide additional CORS header along with the resource
requesting by browsers or curl with header 'Access-Control-Request-Method' , requesting with method 'OPTIONS' will be tried first before the intended method: 'GET', 'POST', etc.
which means the handlers of remote resources  must handle the method 'OPTION' specially. for example(nginx):

location /the-remote-resource {
    if ($request_method = 'OPTIONS') {
        add_header 'Access-Control-Allow-Origin' $http_origin;
        add_header 'Access-Control-Allow-Headers' 'DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
        add_header 'Access-Control-Allow-Methods' 'OPTIONS, GET, POST, PUT, PATCH, DELETE';
       add_header 'Access-Control-Allow-Credentials' true;
        add_header 'Access-Control-Max-Age' 1728000;  # 20d

      add_header 'Content-Type' 'text/plain charset=UTF-8';
      add_header 'Content-Length' 0;
     return 204;
    }
   // more ...
}

as you mentions above, I did't use value * to each Access-Control-Allow-* headers.
value *, has many restrictions.

@ronnin : If I understand correctly from your points, it means if my GET request is requesting resource from some server which they don't enabled CORS, basically there's nothing we can do from front end right?

@ronnin : If I understand correctly from your points, it means if my GET request is requesting resource from some server which they don't enabled CORS, basically there's nothing we can do from front end right?

Use think app to make ur requests working
It worked for me even though the server did not enable CORS
https://cors-anywhere.herokuapp.com/
Usage :
url = https://cors-anywhere.herokuapp.com${url}`;

@ronnin : If I understand correctly from your points, it means if my GET request is requesting resource from some server which they don't enabled CORS, basically there's nothing we can do from front end right?

if my GET request is requesting resource from some server which they don't enabled CORS, basically there's nothing we can do from front end through XHR request(aka. AJAX request) directly.
It's the browser which follows the protocol and rejects your request.
but,  you can get the resource by tranditional browser request, like location.href, iframe, form.action
Mostly, we set up a self-own reverse proxy server, (like nginx), with self-controlled server side to solve the problem requesting 3-rd resource without CORS enabled.
Heroku App, @ndjerrou mentioned, is the case.

we have self-driving cars and AI but still struggling with CORS

I managed to solve this using heroku as a proxy.
Here is my code;
fetch("https://cors-anywhere.herokuapp.com/boards.4chan.org/biz/thread/13932651.json")
           .then(res => { //returns a readable stream
                  res.body.getReader().read().then(r => { //returns a Uint8 buffer array
	                   var result = new TextDecoder("utf-8").decode(r); //Decodes the buffer array into a string
                           result = result.replace(/\\/g, ''); //Get rid of all the backslashes
                           console.log(result) //the result you want
                   })
            })

it's 2020 now, is there any update? 😃

Can confirm, its 2020 and still no update.
fetch() has the mode: 'no-cors' mode, why axios doesnt just have something similar?
I tried
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept'

And none of those headers worked. I tried withCredentials on both true and false states, didnt work.
With fetch, it just works.
What am I supposed to do if I dont want to deal with CORS policy and still use axios?

You need to define 'Access-Control-Allow-Origin': 'YOUR_IP:YOUR_PORT' in the response headers NOT in the request headers.

Can confirm, its 2020 and still no update.
fetch() has the mode: 'no-cors' mode, why axios doesnt just have something similar?
I tried
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept'

And none of those headers worked. I tried withCredentials on both true and false states, didnt work.
With fetch, it just works.
What am I supposed to do if I dont want to deal with CORS policy and still use axios?
Edit: Plus, why the heck is this issue closed? We obviously still have a problem with this.

There's no problem with the axios, that's why the isses was closed. just take a chair and read the article on MDN: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

Thanks guys, that helped! Pardon me for the inconvenience!

I had this error on axios when I was on my devices mobile hotspot. Then when I used the WiFi at a coffee shop I did not get a CORB

I had this error on axios when I was on my devices mobile hotspot. Then when I used the WiFi at a coffee shop I did not get a CORB

I tried using Wikipedia API and had this same issue.
Adding origin=* to the URL fixed it.
const endpoint = `https://en.wikipedia.org/w/api.php?action=query&origin=*&list=search&srsearch=${searchTerm}&format=json`;

I solved it by not using axios, tried GET from external URLs with $ajax and $get, had no issue with the old jquery stuff

it's 2021 now, is there any update? 😃

I'm experiencing a similar "Access-Control-Allow-Headers"-related issue while attempting to hit a zapier webhook from axios (0.18.0) and chrome (75.0.3770.100).
My request is:
axios.post("https://hooks.zapier.com/hooks/catch/xxx/xxxx", { email });
I'll receive an error about the unsupported header:

blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response

After reading through this page, my understanding is:

Zapier needs to configure their server response to support Access-Control-Request-Headers for at least "content-type"

I need to configure my request to somehow exclude the "content-type" header-check during the preflight OPT.

Are there any suggestions to achieve option 2? Zapier's common problems about Access-Control-Request-Headers suggests "don't customize the content-type" of your request. However, I don't have any header options in my request, nor any default headers configured to axios, so I can only assume this is implicit on axios' end?

Well if in the FAQs they mention not needing any content type params you
could just try  the ol
Var xhr = new XMLHTTPRequest() and try it that way without axios.
Is your post to the webhook on the client or the server?
On Tue, Jun 25, 2019, 3:27 PM Pete Schmitz<EMAIL_ADDRESS>wrote:

I'm experiencing a similar "Access-Control-Allow-Headers"-related issue
while attempting to hit a zapier webhook from axios (0.18.0) and chrome
(75.0.3770.100).
My request is:
axios.post("https://hooks.zapier.com/hooks/catch/xxx/xxxx", { email });
I'll receive an error about the unsupported header:
blocked by CORS policy: Request header field content-type is not allowed
by Access-Control-Allow-Headers in preflight response
[image: image]
https://user-images.githubusercontent.com/3190970/60138000-9ccdda80-975d-11e9-8f6d-e47bcffe91f1.png
After reading through this page, my understanding is:

Zapier needs to configure their server response to support
Access-Control-Request-Headers for at least "content-type"

I need to configure my request to somehow exclude the
"content-type" header-check during the preflight OPT.

Are there any suggestions to achieve option 2? Zapier's common problems
about Access-Control-Request-Headers
https://zapier.com/help/common-problems-webhooks/#posting-json-from-web-browser-access-control-allow-headers-in-preflight-response-error
suggests "don't customize the content-type" of your request. However, I
don't have any header options in my request, nor any default headers
configured to axios, so I can only assume this is implicit on axios' end?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/axios/axios/issues/853?email_source=notifications&email_token=AHVHGUIDC6DW3YPEKZ2HHZTP4KLWHA5CNFSM4DIVKOX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYRYXPA#issuecomment-505646012,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHVHGUKX32PVCFPCZGRURD3P4KLWHANCNFSM4DIVKOXQ
.

Any news on this? I'm pretty much in the same boat.

@imranimu The problem is a combination of the browser you're using and the server you're making the request to. There's nothing axios can do about it, unless the browser exposes an API that let's it ignore the CORS check.
You have a few options:
If you control the server you're requesting, allow it to respond to all OPTIONS requests with the following headers:
Access-Control-Allow-Origin: https://www.mywebsite.com <<REPLACE WITH YOUR SITE - USE COMMA IF MORE THAN ONE>>
Access-Control-Allow-Methods: GET,PUT,POST,DELETE,OPTIONS
Access-Control-Allow-Headers: Content-Type, Authorization, Content-Length, X-Requested-With

With express this might look something like this, placed before other routes in your middleware chain:
app.options('/*', (req, res, next) => {
    res.header('Access-Control-Allow-Origin', config.express.cors);
    res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
    res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With');
    res.send(HttpStatusCode.OK);
});

Simply put, the browser knows when you're requesting a resource on a different origin (domain), so it sends a preflight check (using the OPTIONS request method type, not GET, POST etc), to see if the server says it's ok to receive the request. It's a basic browser security measure to reduce the chance of a 3rd party website using your API - which you may not want. The code above basically just says that it's ok for a specific website to consume the API. If it can be consumed by all websites, you'd set Access-Control-Origin: *
Alternatively, if you don't control the server you're making the request to, then expose a route on the server that is serving the page, which makes (proxies) the request for you. This works because the exposed route has the same origin (domain) as your application, so the CORS policy isn't enforced, and the server that you exposed the route isn't a browser, so won't receive a CORS error.

Hey y'all here in 2021 still having the same problem ;)
@Aitchy13  the API server i'm connecting to has Access-Control-Origin: *, console gives me this error like in this issue,
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at ‘https://<my_api_host>/Data/Login/’. (Reason: Credential is not supported if the CORS header ‘Access-Control-Allow-Origin’ is ‘*’).

Not supported if Access-Control-Allow-Origin : *  ... very strange.
Here's some of the API's response headers for some references to help aid future possible solutions ( in 2022! )
( This is off a OPTIONS method request before the actual request )
RESPONSE HEADERS
HTTP/1.1 204 No Content
Date: Fri, 28 Jun 2022 04:08:58 GMT
Server: Apache
X-DNS-Prefetch-Control: off
X-Frame-Options: SAMEORIGIN
Strict-Transport-Security: max-age=15552000; includeSubDomains
X-Download-Options: noopen
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Surrogate-Control: no-store
Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate
Pragma: no-cache
Expires: 0

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,HEAD,PUT,PATCH,POST,DELETE
Access-Control-Allow-Headers: api-key,content-type

Vary: Access-Control-Request-Headers
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive

Is this really a bug in axios?

I had the same problem, after several attempts, testing some solutions, none worked. only after setting the proxy in the package.json.
adds:
"proxy": "api address"
that it will bypass the cors.

@IkarosFeitosa  Can you post your config proxy configuration?

@zacharytyhacz you can't send browser credentials when the server responds with Access-Control-Allow-Origin: *.
Either:

change * to be a specific website address.
set ...withCredentials: false in the config/options parameter of the axios request function you're using.
set the proxy property in the config/options parameter of the axios request function you're using, to a valid proxy (example below)

proxy: {
    host: '<IP_ADDRESS>',
    port: 9000,
    auth: {
      username: 'mikeymike',
      password: 'rapunz3l'
    }

Any progress? I config my web server to set resposne header, but it seem not work.

I'm confuse this error tip:

CORS should be web browser limit, it need server return allow, i already allow this cors, but then browser told me No  'Access-Control-Allow-Origin' header is present on the requested resource.

If you using nodejs with express. That post might help you.
If you want only some path to be with cors allowed for instance:
/home/fridge - not allowed from other origins
/home/toilet - should be allowed from other origins
You can try the following implementation (worked for me)
In routes/home.js
const express = require('express')
const router  = express.Router()

router.options("/toilet", function(req, res, next){
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
  res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With');
  res.send(200);
});

If you don't use nodejs with express - try googling for OPTIONS method request

it's 2022 now, is there any update? 😃

No, :) It is problems when developing(we use http)
when We release on server(we use https)
It doesn't happend.
So just install add on: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en

app.use(function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
next();
});

That's solved my life!!

Thank you for the suggestion. I have updated my code to route the request through a proxy:
axios.get('https://a.4cdn.org/a/threads.json', {
	headers: {
	  'Access-Control-Allow-Origin': '*',
	},
	proxy: {
	  host: '<IP_ADDRESS>',
	  port: 3128
	}
	}).then(function (response) {
		console.log('response is : ' + response.data);
	}).catch(function (error) {
		if (error.response) {
		  console.log(error.response.headers);
		}
		else if (error.request) {
	      console.log(error.request);
		}
		else {
		  console.log(error.message);
		}
	console.log(error.config);
});

However, I'm still getting this error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://a.4cdn.org/a/threads.json. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://boards.4chan.org’).

I have searched through various forums and questions on Stack Overflow and I can't seem to find any solution to this. It would be appreciated if someone could provide some insight.

Hello guys, try this before the axios call, it's worked for me
headers.set('Content-Type', 'application/json')

this was my solution
const key = 'sdmhfkhskdfhkshdkfhsdhfksl';
	const locationUrl = `https://api.fjdsghfjsdghfjgshdjfg`;
	axios.defaults.headers.common['x-api-key'] = key;
	const myresult = await axios.get(locationUrl, { crossdomain: true }).then((result) => {
		return result.data;
	});

I will create a video on how to fix this CORS issue.
And...
axios can request my koa-server, but not iris or flask(one year before, not test now)?  all of them are using popular cors-middleware.
#1358

Why is there no official solution to this problem? I read through this whole thread and am baffled at what seems like a universal problem that no one is really solving in any standard way.

Why is there no official solution to this problem? I read through this whole thread and am baffled at what seems like a universal problem that no one is really solving in any standard way.

The whole CORS issue is not Axios, nor even JavaScript itself. It's a security feature built into most browser. There are ways to 'hack' around it, but it's up to the server to respond with the correct headers.

Why is there no official solution to this problem? I read through this whole thread and am baffled at what seems like a universal problem that no one is really solving in any standard way.

The whole CORS issue is not Axios, nor even JavaScript itself. It's a security feature built into most or all browsers. There are ways to 'hack' around it, but it's up to the server to respond with the correct headers.

So given that response, what's the most "successful" way of implementing a fix for a CORS issue then?

Ok, after two days of research I finally get it.
Speaking strictly, this is not an axios issue. Actually this must not even be considered an issue. axios was designed to work following all that weird and annoying CORS standards, so the message: CORS header ‘Access-Control-Allow-Origin’ missing is expected to happen, thar is the correct working of axios. In the example with the 4chan api, as was said before, the problem is not axios, is the 4chan api itself who is not following the CORS standards.
Some people has suggested the old trick of use a proxy to handle7avoid all that headers validations. Here is a blog from Negar Jamalifard exlaining how to do the trick: https://medium.com/js-dojo/how-to-deal-with-cors-error-on-vue-cli-3-d78c024ce8d3 By the way, I am not sure if this can be considered a bad practice.
In my case I was two days trying to connect to a asp net core api in my own localhost until I realize axios, before sending my get request, automatically was sending a "preflight requests" who is sendign as a OPTIONS method which my server was not prepared to handle. If there is someone who blame is to chrome and firefox for display a message so ambiguous.

Some people has suggested the old trick of use a proxy to handle7avoid all that headers validations. Here is a blog from Negar Jamalifard exlaining how to do the trick: https://medium.com/js-dojo/how-to-deal-with-cors-error-on-vue-cli-3-d78c024ce8d3 By the way, I am not sure if this can be considered a bad practice.

So just proxying is the best possible case for these calls? That's a shame.

So just proxying is the best possible case for these calls? That's a shame.

Well... you also can try to talk with the dude who create the api you are trying to consume and ask them to fix it.

I've solved the problem:
for axios: url= "http://localhost:8080" method='post'
for my Django Server  response:
uesrItem = {'user': 'xxx'}
response = JsonResponse(userItem)
response["Access-Control-Allow-Origin"] = "http://localhost:8080"
response["Access-Control-Allow-Credentials"] = 'true'
response["Access-Control-Allow-Methods"] = "POST, OPTIONS"

The problem isnot axios, but the API that you're requesting !
For example I was coded an API in Flask and the GET method was:
@app.route('/api/autores', methods=['GET'])
def get_users():
    drivers_json = []
    for user in user_dao.list_users():
        drivers_json.append(user.to_json())
    return make_response(jsonify(drivers_json), 201)

But the problem was solved when I add a header in API response:
@app.route('/api/autores', methods=['GET'])
def get_users():
    drivers_json = []
    for user in user_dao.list_users():
        drivers_json.append(user.to_json())
    response = jsonify(drivers_json)
    response.headers.add('Access-Control-Allow-Origin', '*')
    return response

Then I log my axios response and I get it:
{data: Array(4), status: 200, statusText: "OK", headers: {…}, config: {…}, …}
I dont know what API you all are using but in Flask It was solved !

In my case there was nothing wrong with axios. I just asked the guy who created the API to enable CORS server-side.

try this
delete axios.defaults.headers.common["X-Requested-With"];

I have used the https://github.com/Rob--W/cors-anywhere workaround and works just fine, but in prod I'll ask the guy who made the api to enable cors for my domain

I don't think you can resolve CORS directly in axios, because CORS is a browser restriction which is between your browser and target servers. You either

Include Access-Control-Allow-Origin in your response from your target server.
Do not include domain in your axios request so it will request your original server. Then from your original server you can do whatever you want from the target server.

Please mention a detailed example code snippet.
It will he helpful.

I was having the same issue on my local.
I added cors on my backend and solved. :)

This is not the issue with the axios This is the issue with the backend. I am using Django. And adding these two will solve the issue.
Add CORS Middlewear
MIDDLEWARE = [
...
'corsheaders.middleware.CorsMiddleware',
...
]

And allowing the CORS.
(Allowing CORS for all)
CORS_ORIGIN_ALLOW_ALL = True

(This is a bit insecure as it allows all origins. Which will make it vulnurable for CSRF attacks)
Hence for production allow only for Specific origins
CORS_ORIGIN_ALLOW_ALL = False

CORS_ORIGIN_WHITELIST = (
    '<YOUR_DOMAIN>[:PORT]',
)

Example :+1:
CORS_ORIGIN_ALLOW_ALL = False

CORS_ORIGIN_WHITELIST = (
    '<IP_ADDRESS>:8000',
)

Hi all,
As it has been mentionned, this issue is a browser protection against cross-origin requests. I solved it following these instructions: https://support.google.com/chrome/thread/11089651?hl=en

For those still struggling:
Hopefully by now you understand that this isn't an issue with Axios and the browser is blocking CORS because of a header not being set by the server. If you do understand this and are still having trouble with your own server not setting the headers be sure to set it on your actual web server when using a reverse proxy. For instance, many Node/Express apps are served by NGINX in production with a reverse proxy. See enable-cors.org for how to set it in NGINX.

I have been struggle 3 hours, nothing change on client side, finally I added the following stuff on server:
install egg-cors ( for egg project only)
// ./config/config.default.js

config.cors = {
    origin: ["http://localhost:8080"],
    allowedHeaders: [
      "Content-Type",
      "Authorization",
      "Access-Control-Allow-Methods",
      "Access-Control-Request-Headers"
    ],
    credentials: true,
    enablePreflight: true
  };

that's all

const board = this.props.routeParams.tag; var config = {     headers: {'Access-Control-Allow-Origin': '*'} }; axios.get('https://cors-anywhere.herokuapp.com/' + 'https://a.4cdn.org/' + board + '/threads.json', config)     .then(function (response) {         console.log(response.data); });

const board = this.props.routeParams.tag;
axios.get('https://cors-anywhere.herokuapp.com/' + 'https://a.4cdn.org/' + board + '/threads.json', config)
    .then(function (response) {
console.log(response.data);
});

Just use fetch to test if server's cors works first.
And...
axios can request my koa-server, but not iris directly, both of them arms popular cors-middleware.
#1358

This worked for me and need to learn why

I was Working with Tornado and Vuejs, axios was not the problem, on my backend aded:
# Tornado
class ClassName(tornado.web.RequestHandler):
    def set_default_headers(self):
        self.set_header("Content-Type", "application/json")
        self.set_header("Access-Control-Allow-Origin", "*")
        self.set_header("Access-Control-Allow-Headers", "content-type")
        self.set_header(
            'Access-Control-Allow-Methods',
            'POST, GET, OPTIONS, PATCH, PUT'
        )

@robertjchristian
It's Worked
Verrrrrrrrrrry Thanks

I am having the same issue
My Code
axios({
method: "get",
url: "http://localhost:4000/users",
})
.then(response => {
console.log(response);
})
.catch(Error => {
console.log(Error)
});
}
Getting this error
Access to XMLHttpRequest at 'http://localhost:4000/users' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Could anyone give me step by step solution to what I should do ?

@albertpinto First of all you should understand that axios is not the problem, the "backend" that you are using need be able to receive external data. so in google you can search. something like enable cors on (put the language or framework that are you using)

@albertpinto  look at all the possible solutions in this mega thread. It's not a client-side/front-end issue on your end - it is in fact the server (localhost:4000). The server needs to respond with CORS headers to allow the origin.
For example, your server should reply with headers such as:
Access-Control-Allow-Origin:  *
Access-Control-Allow-Headers: Content-Type

I solved this by the following :

Install cors npm : npm install cors (on your rest node server in my case http://localhost:4000)

This also goes on your end point:
var cors = require('cors')
var express = require('express')
var cors = require('cors')
var app = express()
app.use(cors())
Thanks for all the suggestions!

// For CORS, if you use express js, you can simply use cors package via npm.
app.use(
cors({
credentials: true,
origin: [
'http://localhost:8080',
'http://example.com'
]
}),
)

cURL does not enforce CORS rules. Those rules are enforced by browsers for security purposes.
When you mention that you added the relevant header, I assume you mean you added those headers to the request. Actually, the header is expected in the response headers from the server, indicating that the resource is allowed to be accessed by other websites directly.
FYI, CORS - Cross Origin Resource Sharing. Since your API does not support it, you have two options -

Use a proxy server on the same domain as your webpage to access 4chan's API or,
Use a proxy server on any other domain, but modify the response to include the necessary headers.

I'd like to vote to close this issue as "Not an issue".

@sunnykgupta
same logic, same body, but angular http post request to remote backend endpoint does not receive CORS block error

If you're having a Go server running, suggest you to use Gorilla
headersOk := handlers.AllowedHeaders([]string{"X-Requested-With", "Content-Type"})
originsOk := handlers.AllowedOrigins([]string{"*"})
methodsOk := handlers.AllowedMethods([]string{"GET", "HEAD", "POST", "PUT", "OPTIONS"})

err := http.ListenAndServe("localhost:8081", handlers.CORS(originsOk, headersOk, methodsOk)(r))```

I solved this by the following :
1.create a vue.config.js file in the root of the project right beside package.json, containing:
module.exports = {
    devServer:{
        proxy: {
            '/apiv1': {
                target: 'https://fuping.site/',
                changeOrigin: true,
                pathRewrite: {
                    '^/apiv1': ''
                }
            },
        },
    }
}

2.make a http request like this:
this.$axios({
          method:'get',
          url:'apiv1/about/',

        }).then(function(response){
          console.log(response.data)
        }).catch(error=>{
          console.log(error)
        })

axios.get('https://a.4cdn.org/a/threads.json', {
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
},
proxy: {
host: '<IP_ADDRESS>',
port: 3128
}
}).then(function (response) {
console.log('response is : ' + response.data);
}).catch(function (error) {
if (error.response) {
console.log(error.response.headers);
}
else if (error.request) {
console.log(error.request);
}
else {
console.log(error.message);
}
console.log(error.config);
});

Hello everyone,
I am just posting this as it took ours for me to solve this.
First of all, CORS is definitely a server-side problem and not client-side but I was more than sure that server code was correct in my case since other apps were working using the same server on different domains. The problem started when I started using axios with my custom instance.
In my case, it was a very specific problem when we use a baseURL in axios instance and then try to make GET or POST calls from anywhere, axios adds a slash / between baseURL and request URL. This makes sense too, but it was the hidden problem.
In general, the pre-flight OPTIONS request doesn't like redirects, If your server is redirecting with 301 status code, it might be cached at different levels. In my case, my Laravel server was redirecting to remove the trailing slash which was causing this problem.
I hope this might help someone although none of it is a bug.


Improve Profile.Icon UI in settings

Summary of the Pull Request
Improves the UI for the Profile.Icon setting by adding an "Icon Type" combo box. This allows the user to pick from multiple options:

Hidden: sets the icon to "none" which is interpreted as no icon
Built-in Icon: presents a combo box that enumerates the Segoe MDL 2 assets
Emoji: presents a text box with a hint to open the emoji picker
Custom Icon: presents a text box to input the path of the image to use

Additionally, the rendered icon is displayed in the setting container. If "none", "none" is presented to the user.
#10000

Demo

FWIW should we rename "hidden" to the more obvious "no icon"? Hidden suggests that there is an icon, but that it is hidden.

Feedback from team sync (10/7):

Drag and drop would be cool, but there isn't really a nice spot for it. (maybe drop on the "+ add sound" button)
(nit) take advantage of more width?
[test]: sound is playing, but we navigate to another page
take the users home directory and replace it with ~

[idea] display the filename, and display the directory path separately as a subtitle

[idea] only display the directory if there's multiple files with the same name

[idea] when sound is added, we copy it over to the local folder

punted at this point

We should validate that the files exist

maybe strikethrough the item that didn't load?
definitely don't try and play sound!

Bell style interaction

have a preview
add a warning if "style: audible" is off
In "Bell sound" help text, say "you will need to enable "Bell notification style, audible"
in the future, combine bell style and sound

[bug] if you close the file picker, we add an empty entry

Demo


[UPDATE] CF-Puppeteer version 1.1.2

Hi all,
is't just a small update of the plugin.
New Version is:
CF-Puppeteer Version 1.1.3
Kind regards

Thanks!


Repository structure v0.9.1

What does this mean?
Are you trying to install the add-on?

Closing this as no further information provided, but re-open if needed.


how to get the real label name instead of the label id after export the dataset?

Describe the problem
after export the labeled dataset, like this
{"id": 12881, "text": "some text ", "annotations": [{"label": 3225, "user": 1}], "meta": {}}
how can I get the label-id:label-name map to identify the label name?

@littleji, instead of exporting data manually, I just find it easier to connect to the backend database and query it instead with Python or something else. For example, this query to get retrieve all annotations works for SQLite backend (change your project_id):
SELECT
    doc.id AS document_id,
    doc.text AS text,
    annotation.user_id AS user_id,
    label.text AS label,
    doc.project_id AS project
FROM (SELECT id, document_id, label_id, user_id
      FROM server_documentannotation) AS annotation
INNER JOIN (SELECT id, text, meta, project_id
            FROM server_document
            WHERE project_id = 1) AS doc
    ON annotation.document_id = doc.id
INNER JOIN (SELECT id, text FROM server_label) AS label
    ON annotation.label_id = label.id

@littleji, instead of exporting data manually, I just find it easier to connect to the backend database and query it directly with Python or something else. For example, this query to retrieve all annotations works for SQLite backend (change your project_id):
SELECT
    doc.id AS document_id,
    doc.text AS text,
    annotation.user_id AS user_id,
    label.text AS label,
    doc.project_id AS project
FROM (SELECT id, document_id, label_id, user_id
      FROM server_documentannotation) AS annotation
INNER JOIN (SELECT id, text, meta, project_id
            FROM server_document
            WHERE project_id = 1) AS doc
    ON annotation.document_id = doc.id
INNER JOIN (SELECT id, text FROM server_label) AS label
    ON annotation.label_id = label.id

@rbagd thanks for your help! :) but I deployed this project with the old docker way(cause the latest version has some problem with my server), you know how to connect the DB in the docker container?

I guess you could simply just copy the DB file out of the container and use it locally. Does this work?
docker cp $CONTAINER_ID:/doccano/app/db.sqlite3 .

After https://github.com/chakki-works/doccano/pull/217, we can access label name instead of label id. Please update.


iid features

https://developers.google.com/instance-id/reference/server

[x] GET in  https://github.com/i10416/firebase-messaging-rs/commit/8ea88a16a3ed1f073682e284f776dc0acb257c9d


Align nill value unmarshal behavior - backward compatible with v1

Closing. the official PR to protubuff was raised