My curl message updates a webhook on my website perfectly when I run the site locally, using 'localhost:800' as the URI, with 'ws://localhost:8080/ws' in the webpage javascript code and "curl -H "cache-control: no-cache" -H "content-type: application/json" -XPOST -d '{"object":"event","data":{"paid":true}}' localhost:8080/webhook" as the curl message sent. However when I send the same curl message to the Heroku hosted site:'https://XXXX.herokuapp.com/webhook' with 'ws://XXXX.herokuapp.com/ws' on the webpage it doesn't update with the info received in the curl, though from the Heroku logs I can see that the message was received. Does anyone know what the problem might be?
Turns out I just needed to change "var exampleSocket = new WebSocket("ws://myapp.herokuapp.com/ws")" to "var exampleSocket = new WebSocket("wss://myapp.herokuapp.com/ws")" in the .html page. Now it works fine. I have a SSL Cert in Heroku for that App and this seems to work with wss as well as https
Related
I'm attempting to set up a manual back up process for elastic search with ansible.. but when I attempt to curl the elastic server page I get an empty response from the console. No error message, no text, just empty.
I run curl https://website.etc.com:500 and that gives me an SSL error stating that the peers certificate issuer has been marked as not trusted by the user.
So I attempt to ignore ssl and curl -k url:port and it gives me a blank line in the console.
Why can't I curl this website???
I successfully setup HTTPS for Elasticsearch server. Now I can use curl like curl -u elastic:111111 --cacerts "Path/to/my/cert" https://localhost:9200. How can I setup to use curl without user authentication and cert?
Sorry for my bad English :(
I run keycloak in a docker container and run my spring boot app from the idea.
When I try to login in the keycloak form I get back an error
failed to turn code into token
status from server: 401
{"error":"unauthorized_client","error_description":"Client secret not provided in request"}
and the exception is:
org.keycloak.adapters.springsecurity.KeycloakAuthenticationException: Invalid authorization header, see WWW-Authenticate header for details
Inside keycloak admin panels I have configured my users and roles.
The properties file:
keycloak.realm=myrealm
keycloak.resource=myclient
keycloak.auth-server-url=http://localhost:8081/auth
keycloak.ssl-required=external
keycloak.public-client=true
keycloak.principal-attribute=preferred_username
keycloak.credentials.secret=eba15252-we3r-423e-8df0-87f1da4a7c04
keycloak.use-resource-role-mappings=true
Could you please someone help how to fix this?
**UPDATE: if I run keycloak without docker it works.
Its clear, in the post request you are not entering client_secret. You should be able to get this from Clients section in Keycloak admin. Thats how your request should look like.
curl --location --request POST '{{KEYCLOAK_BASE_URL}}/auth/realms/{{KEYCLOAK_REALM}}/protocol/openid-connect/token' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'client_id=web-app-client' \
--data-urlencode 'username=user#gmail.com' \
--data-urlencode 'password=123123' \
--data-urlencode 'client_secret=ea05b21c-fcb4-412d-acb7-c888ba7f996d' \
--data-urlencode 'scope=openid phone address'
Trying to query Watson discovery news with the following curl command and get error 403 forbidden.
curl -u "apikey":"{apikey}" "https://gateway.watsonplatform.net/discovery/api/v1/environments/system/collections/news-en/query?version=2019-04-30&query=relations.action.lemmatized:acquire&count=3&filter=entities.text:IBM&return=text"
I found documents on the IBM site to create and query your own environments but not help with how to access the news.
It turned out my url was incorrect. I got this to work.
curl -u "apikey":"{apikey}" "https://api.eu-gb.discovery.watson.cloud.ibm.com/instances/96a866f9-11bb-4b55-af26-a0f826807fec/v1/environments/system/collections/news-en/query?version=2019-04-30&query=enriched_title.semantic_roles:(action.normalized:acquire,object.entities:(type::Company))&count=3"
Your curl looks correct, which may indicate that your apikey is incorrect. Try running the curl command to list environments:
curl -u "apikey":"{apikey}" "https://gateway.watsonplatform.net/discovery/api/v1/environments?version=2019-04-30"
that should verify that you have the correct apikey.
I want to automate and monitor my websocket connection whether it is able to send successful response for the connection request. I know different plugins already available but I am looking for a script whether in bash or ruby so that it can test my websocket connection and successful message .
Any help will be very much appreciated .
Run
curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: echo.websocket.org" -H "Origin: http://www.websocket.org" http://echo.websocket.org
Where http://www.websocket.org is host origin, and echo.websocket.org is endpoint for websocket.
Those flags say:
Return headers in the output
Don’t buffer the response
Set a header that this connection needs to upgrade from HTTP to something else
Set a header that this connection needs to upgrade to a WebSocket connection
Set a header to define the host (required by later WebSocket standards)
Set a header to define the origin of the request (required by later WebSocket standards)
If your WebSocket is working running the above should return the handshake information, for further information, refer to this post