Comments (8)
I had solution for it by update cors through API. Thanks @lafirest !
from emqx.
@huynhttdev did you find a solution for this problem ? if you find one what is it ?
from emqx.
@huynhttdev
You need to set the dashboard.cors
to true
, you can find details at here.
from emqx.
How can i find file config bro? @lafirest
from emqx.
@lafirest After set dashboard.cors is true, the error still persists because the browser makes a preflight request with the OPTIONS method, and it seems that this method is not supported.
from emqx.
@ysfscream could you assist here?
from emqx.
@huynhttdev did you find a solution for this problem ? if you find one what is it ?
I created nodejs demo project. In this project, I called to EMQX API without setup cors middleware. I fixed this by the following code:
const cors = require("cors");
app.use(cors());
Remember to add auth
config in Axios:
const commonAxios = axios.create({
baseURL: "",
auth: {
username: "", // Can get at Emqx dashboard website
password: "", // Can get at Emqx dashboard website
},
...
});
from emqx.
I wasn't able to replicate this issue. After obtaining the API key, I requested the remote server from my local setup, and everything worked as expected. Here is an example of my code for reference.
![image](https://private-user-images.githubusercontent.com/21299158/293824005-44bceaad-516d-4ab8-b257-e9654e8b5bfb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgzMjgyODcsIm5iZiI6MTcxODMyNzk4NywicGF0aCI6Ii8yMTI5OTE1OC8yOTM4MjQwMDUtNDRiY2VhYWQtNTE2ZC00YWI4LWIyNTctZTk2NTRlOGI1YmZiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE0VDAxMTk0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY3M2YyMzhlMTU5ODMzNDljYmZiMmRkMGY3MzFmZDI5MTM2Mjg5ODMxMTQ0OWM5MDY4ODQ2YjA0YTJkYmFhYTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rRbQJRqliU0KnxPwvfZQi3DwwPtlIAvoaBcT6MANjLs)
Given the uncertainties regarding the specific project environment, if you are making Axios requests to the API within a browser-based frontend project, you might need to configure a reverse proxy to circumvent the CORS issue. This approach is a standard solution, especially when frontend applications need to communicate directly with backend services. I hope this information is helpful to you.
![image](https://private-user-images.githubusercontent.com/21299158/293824084-09ec7df7-5657-44ac-a4d3-9f2094f0d964.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgzMjgyODcsIm5iZiI6MTcxODMyNzk4NywicGF0aCI6Ii8yMTI5OTE1OC8yOTM4MjQwODQtMDllYzdkZjctNTY1Ny00NGFjLWE0ZDMtOWYyMDk0ZjBkOTY0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE0VDAxMTk0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY0YmMzMzgxOTU1MjcwNzlmOGM1OTgwMGRjY2NkZWUzZDZkNDgzNjM2ZWMyN2M1ZjZmZmJiNzhkMDM2NWE5Y2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.B416X-5epaSmdjDYw-2DYLqNWYqcLy4Fs-iyyl3s3To)
from emqx.
Related Issues (20)
- For my project required kafka and kerberos integration with EMQX opensource,So any how is it possible to do these integration with Emqx OPenSource version HOT 2
- Get acknowledgement from subscriber(s) after publish messages HOT 2
- Restored retained message have no payload HOT 2
- error messages received and MQTT broker keep running up and down, very HOT 4
- Several protocol violations or bugs in EMQX HOT 26
- Upgrade to Openssl 3.0 or higher HOT 7
- LDAP server treated as down due to wrong error returned than expected? HOT 5
- EMQX Cluster error msg: failed_to_kick_session_on_remote_node HOT 5
- Bug: v5.7.0 /api/v5/monitor API return 500 Error becasue of the incompatible conf changes HOT 4
- MemoryDB certificate verification fails after upgrade to version 5.7.0 HOT 8
- How to automatically create a configuration file after the container starts HOT 4
- how to configure different ACLs for different listeners HOT 9
- [Website] Emqx.io Does Not Allow to Download The Open Source Version Anymore HOT 2
- Make auto block support blocking Usernames and IPs HOT 2
- The Client ID prefix in the MQTT bridge does not take effect HOT 2
- The Client ID used by the MQTT bridge is generated according to fixed rules HOT 2
- Allow users to explicitly persist Dashboard configuration
- Connector to MQTT host fails with bad username/password, other clients connect normally HOT 2
- But I found that it was sent successfully, and I also subscribed to this topic. Should return 200 and messageid HOT 1
- Feature Request: Add exact_match Parameter to JWT ACL HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emqx.