Tried on my machine directly and got:
PS C:\Users\ayuan> curl.exe -k -X GET https://localhost:5001/api/Airlines -H 'Host: galuugateway'
[{"airlineID":9,"name":"DAL"},{"airlineID":8,"name":"TDY"}]
PS C:\Users\ayuan> curl.exe -k -X GET https://gluugateway:8443/api/Airlines -H 'Host: galuugateway'
{"code":404,"message":"HTTP 404 Not Found"}
However, tried from Angular still got CORS error:
Access to XMLHttpRequest at 'https://gluugateway:8443/api/Airlines/' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Hit the URL directly https://gluugateway:8443/api/Airlines and got:
{
"code": 404,
"message": "HTTP 404 Not Found"
}
environment.ts:
export const environment = {
production: false,
client_id: '6ab094c7-ec96-42e0-b789-7beffdc791e4',
redirect_uri: 'http://localhost:4200/login',
logout_redirect_uri: 'http://localhost:4200',
openid_connect_url: 'https://gluusrv',
end_session_endpoint: '/oxauth/restv1/end_session', // you gluu server end_session_endpoint
scope: 'openid email profile',
extra: {prompt: 'consent', access_type: 'offline'},
ggURL: 'https://gluugateway:8443',
airlinesEndpoint: '/api/Airlines/'
};
In API server I use GG, is that correct?
services.AddCors(options =>
{
options.AddPolicy("_myAllowSpecificOrigins",
builder =>
{
builder.WithOrigins("https://gluugateway:8443")
.AllowAnyHeader()
.AllowAnyMethod();
});
});
On GG, should I use "localhost" or IP to set the origin in CORS plug in and in the service?