var corsOptions = {
origin: process.env.CLIENT_HOST,
credentials: true
}
app.use(cors(corsOptions));
Where process.env.CLIENT_HOST
is development-client-service.default
Which looks like this
apiVersion: v1
kind: Service
metadata:
name: client-service
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
selector:
app: client
type: LoadBalancer
status:
loadBalancer: {}
However the error I get from node is.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8080/customers. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘development-client-service.default’).
Where it looks like its not converting the dns to the actual address. Is there something tricky with node here?
Working locally on docker for desktop and the client cors should be http://localhost. There doesn't seem to be anything wrong with the kube-dns on the local system.