I installed ssl for my spa domain and laravel nginx server. After installation I get following error..
/login:1 Access to XMLHttpRequest at 'https://myapiendpoint.io/api/login' from origin 'https://myspasite.io' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I added "allowed_origins" and "allowed_origins_patterns" into cors php according to some articles on stackoverflow but didn't work. What else should I do? Besides when I check the network in dev console it gives 405 method not allowed status as preflight.
config/cors.php
'paths' => ['api/*'];
'allowed_methods' => ['*', 'POST', 'GET', 'DELETE', 'PUT'],
'allowed_origins' => ['*', 'http://app.mysite.io', 'https://app.mysite.io'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false
.env
APP_URL=https://endpoint.mysite.io
SPA_URL=https://app.mysite.io
.
.
.
PASSPORT_LOGIN_ENDPOINT="http://endpoint.mysite.io/oauth/token"
and my server configuration for ssl port.. when I make get request to https api endpoint I get nginx 404 error.. I think my config is wrong.. What it should be?
server {
listen 443 ssl;
ssl_certificate /etc/ssl/server_chain.crt;
ssl_certificate_key /etc/ssl/mysite.io.key;
server_name endpoint.mysite.io;
root /var/www/app/public;
}
Thank you