CORS error when sending events following the quick start guide

Following the quick start guide. Quick start guide | Snowplow Documentation

I don’t think that is a CORS error - it is likely mixed content (as you are trying to send a request to a HTTP endpoint from a HTTPS webpage).

If you have a SSL certificate setup on your load balancer (recommended) then you can simply switch to https and that will resolve the mixed content issue.

Ah I didn’t set SSL certificate, just want to quickly setup a learning env.

Without a SSL, I can’t use this page to test sending a event, right?

In that case can I simply use a curl command to send a request? A sample request would be great.

Thanks for your response

Check out this page: Tracking your first events | Snowplow Documentation

Go to the “community” tab, which states:

If you have not yet configured an SSL certificate and a custom domain name for your Collector, you can use http://<collector_dns_name> (http , not https ), where collector_dns_name is the output of the pipeline Terraform module.

Yeah I’m using http, see the screenshot. What else could cause the issue?

Ah just noticed, why on the left it’s http but in right side chrome inspector it’s https?

Correct - your browser won’t allow the mixed content request.

The easiest way around it (given you’ve got devtools open) is to right click on the request and copy it as cURL - and just switch the protocol to HTTP. This should give you something like

curl 'http://test/i?e=pv&aid=test'

Chrome might give you some headers as well but these aren’t really necessary.

Thanks Mike! I copied as curl from curl as well but found there’s no body in the request.
like this:

curl 'http://test/i?e=pv&aid=test'

could you provide a sample query including a post body?

Sure - here’s another example from the page of a self describing event using the POST endpoint.

curl 'https://HOST/com.snowplowanalytics.snowplow/tp2' \
  -H 'content-type: application/json; charset=UTF-8' \
  -H 'cookie: sp=d5efb628-d401-405a-8d3b-226fc7f88123; _sp_id.1251=38b1046d-9028-4f0d-8502-c41ed0918929.1715818568.1.1722249470.1721870882.df8f4c35-69ef-47e9-8a39-0dfb912f47fc' \
  --data-raw '{"schema":"iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4","data":[{"e":"ue","eid":"2bc12a32-62de-485c-9e06-7eff597af359","tv":"js-3.13.1","tna":"sp1","aid":"test","p":"web","cookie":"1","cs":"UTF-8","lang":"en-GB","res":"3840x1600","cd":"24","tz":"Location/Location","dtm":"1723777346860","vp":"0x0","ds":"0x0","vid":"16","sid":"0ea2a0dc-3e4e-47a5-b5bc-99c16e6798fb","duid":"41c4c8eb-b823-4fc6-a976-2ac1b7c5256d","url":"about:srcdoc","ue_px":"eyJzY2hlbWEiOiJpZ2x1OmNvbS5zbm93cGxvd2FuYWx5dGljcy5zbm93cGxvdy91bnN0cnVjdF9ldmVudC9qc29uc2NoZW1hLzEtMC0wIiwiZGF0YSI6eyJzY2hlbWEiOiJpZ2x1OmNvbS5zbm93cGxvd2FuYWx5dGljcy5zbm93cGxvdy9hZGRfdG9fY2FydC9qc29uc2NoZW1hLzEtMC0wIiwiZGF0YSI6eyJza3UiOiJBU08wMTA0MyIsInVuaXRQcmljZSI6NDkuOTUsInF1YW50aXR5IjoxMDAwfX19","cx":"eyJzY2hlbWEiOiJpZ2x1OmNvbS5zbm93cGxvd2FuYWx5dGljcy5zbm93cGxvdy9jb250ZXh0cy9qc29uc2NoZW1hLzEtMC0wIiwiZGF0YSI6W3sic2NoZW1hIjoiaWdsdTpjb20uc25vd3Bsb3dhbmFseXRpY3Muc25vd3Bsb3cvd2ViX3BhZ2UvanNvbnNjaGVtYS8xLTAtMCIsImRhdGEiOnsiaWQiOiI4NzFjYzg0MS05NGFjLTRjMTQtYmY2OS1kN2IwYWQyYWFkYzcifX1dfQ","stm":"1723777346861"}]}'