I have deployed my own apprtc server with collider & turn server configured in Google App engine locally with virtualbox. Everything is working properly but I want to use this apprtc server in my another project that is in anoter IP. So, Apprtc IP and my project IP is different. Now, when I included apprtc.debug.js & appwindow.js files to my project it cannot initialize loadingParams and says this error message "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://<IP OF APPRTC>:8080/params. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)".
However, entering http://<IP OF APPRTC>:8080/params in the browser gives me correct response but not in the project called in appwindow.js .After a bit of googling I added below lines in sendUrlRequest function :
xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
xhr.setRequestHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
Now it says "CORS request did not succeed".
How can I make it work? Do I have to enable cors in server side also, if so where and how to do that? Please help me, I'm totally lost here...
Related
so as the post says, i'm making an app, for which i have a server/rest api written with the django framework. When i try to call the api using volley, i fail to get any response, and i don't see it show up on my server's dashboard
The server is running on my local machine, and the app is running on an emulator, since i'm using android studio
i'd like to send a request and display the response in a textview on the app, for now thats all i need to continue onto the next part
What ends up happening instead is that it seems to not even hit my server, the app displays the text i set for if the request fails, adn it doesn't show up on the dashboard of my server
here's basically all the code in my mobile app
val textView = findViewById<TextView>(R.id.text)
val queue = Volley.newRequestQueue(this)
val url = "http://127.0.0.1:8000//index"//i also tried to use 192.168.1.2 as the host ip. the port is always 8000
val stringRequest = StringRequest(Request.Method.GET, url,
Response.Listener<String> { response ->
// Display the first 500 characters of the response string.
textView.text = "Response is: ${response.substring(0, 500)}"
},
Response.ErrorListener { textView.text = "That didn't work!" })
queue.add(stringRequest)
Please check the logs. They should show you a security error because you use HTTP clear text traffic.
With the default settings, apps aren't allowed to transmit cleartest HTTP traffic.
You must either add an SSL certificate to your backend or allow HTTP traffic.
Check out this StackOverflow thread to see how to enable clear text web requests.
I've got a NAS (Synology) which hosts soem of my work.
There is a mariadb database, a web server (nginx) and Docker for hosting my personal python API.
Here is a graphical view:
As you can see, I also made a front (Vue JS) web page which uses the python API.
I want to secure all of that with HTTPS.
I successfully add a Let's Encrypt (LE) certificate and the web client use it with no problem.
But the python API is served only over HTTP, on the web client gives this error:
Mixed Content: The page at 'https://mydomain.fr/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://mydomain:12345/myroute'. This request has been blocked; the content must be served over HTTPS.
And I understand it.
So I want my python API to use HTTPS.
I use a gunicorn server, and I tried several things:
Add ssl_context:
app.run(host='0.0.0.0', ssl_context='adhoc')
Add some files given by LE (I don't understand what I do):
CMD ["gunicorn", "--certfile=certificat.pem", "--keyfile=cleprivee.key", "--ca_certs=ca.cer", "-b", "0.0.0.0:5000", "feed:app"]
But I only got "Time out" with thoses tests.
Do I have to use the same certificate as the web server for the api?
How do i "give" it to the api?
I have bot code (node.js) which is deployed into azure by compressing and dropping into https://test.scm.azurewebsites.net/ZipDeployUI, we have python files and flask in our local machine and before i was testing with emulator it worked fine, now after deployed into azure and testing it in Web Chat the local host flask api is not working.
kindly help me how can i communicate flask api from azure bot
Error msges:
Access to XMLHttpRequest at 'https://botservice.hosting.portal.azure.net/botservice/api/Telemetry' from origin 'https://portal.azure.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
Access to XMLHttpRequest at 'https://botservice.hosting.portal.azure.net/botservice/api/ClientTrace' from origin 'https://portal.azure.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
In CORS:
In App Service i have given * and removed all other origins
Errors:
These are the errors i am getting
you need to make sure azure portal > your resource group > your app service > Settings > CORS looks like this:
Please follow below doc for deployment of Bot:
https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-tutorial-basic-deploy?view=azure-bot-service-4.0&tabs=csharp
Also check this for additional reference:
We are getting CORS issue in Azure WebAPP still i have allowed all origin as "*"
Hope it helps.
I am trying to develop login with vk.com feature for our website. And testing it locally. In app I have given
http://127.0.0.1/
as base domain. In website during authorization it is requesting url:
https://oauth.vk.com/authorize?client_id=XXXX&redirect_uri=http://127.0.0.1/vk/login/check/&state=trackid=XXXX..
In callback url, I am calling
https://oauth.vk.com/access_token?client_id=XXXX&client_secret=YYYY&redirect_uri=redirect_uri=http://127.0.0.1/vk/login/check/aaa/bbbb&code=
But its not loading VK website for logging in. It shows error
{"error":"invalid_request","error_description":"redirect_uri has wrong
domain, check application settings"}.
Dont know whats wrong. Any help?
Earlier when testing to request code and accesstoken manually, I had given domain in app as https://www.example.com and used https://www.example.com as redirect url when requesting code and access token. At that time it had worked.
Now how can I test it when our website is running locally? Please help
You should open your 8000 port and put to "redirect_uri" your ip. But it's not exactly work, because u should have your own host
go to your app setting in VK set your redirect-uri http://127.0.0.1:5000/anything (port is important/use Port that you are using according to server hosting service). then try it.
I have my web app API running.
If I go to http://127.0.0.1:5000/ via any browser I get the right response.
If I use the Advanced REST Client Chrome app and send a GET request to my app at that address I get the right response.
However this gives me a 503:
import requests
response = requests.get('http://127.0.0.1:5000/')
I read to try this for some reason:
s = requests.Session()
response = s.get('http://127.0.0.1:5000/')
But I still get a 503 response.
Other things I've tried: Not prefixing with http://, not using a port in the URL, running on a different port, trying a different API call like Post, etc.
Thanks.
Is http://127.0.0.1:5000/ your localhost? If so, try 'http://localhost:5000' instead
Just in case someone is struggling with this as well, what finally worked was running the application on my local network ip.
I.e., I just opened up the web app and changed the app.run(debug=True) line to app.run(host="my.ip.address", debug = True).
I'm guessing the requests library perhaps was trying to protect me from a localhost attack? Or our corporate proxy or firewall was preventing communication from unknown apps to the 127 address. I had set NO_PROXY to include the 127.0.0.1 address, so I don't think that was the problem. In the end I'm not really sure why it is working now, but I'm glad that it is.