Adding loki datasource 502 Bad gateway

I am trying to add loki as a datasource to my grafana but when the connection is tested I get a 502 bad gateway error. http://localhost:3100/metrics is displaying metrics as intended and http://localhost:3100/ready says the system is ready.

Hopefully someone can help, thanks.

I think I have resolved this but I am getting no log labels through, the containers are not producing any errors though.

I am also getting 502 gateway issue , how you resolve that ??