There are 2 different web servers that are deployed under the same domain (example.com and api.example.com)
I want to use httpOnly
cookie shared across these 2 sites.
There is such local configuration:
https://local.example.com
+ IIS Express + ASP MVC
https://localhost:8888
or https://api-local.example.com:8888
+ .net core
Eventually, there are lots of limitations that can not be passed:
- change domain names
- host both apps in a single IIS
I was looking to configure Nginx that would proxy
https://local.example.com:943
to https://local.example.com
https://api-local.example.com:943
to https://api-local.example.com:8888
In common, this works for the .net core API, and I can use Postman to query the data over the Nginx self-signed certificate.
But I can't get it working for the IIS one. Chrome shows the alert and blocks the website
I'm using such nginx configuration
events {}
http {
server {
listen 943 ssl;
listen [::]:943 ssl;
server_name api-local.example.com;
ssl_certificate /etc/nginx/ss.crt;
ssl_certificate_key /etc/nginx/ss.key;
location / {
proxy_pass https://host.docker.internal:8888;
proxy_set_header Host $host;
}
}
server {
listen 943 ssl;
listen [::]:943 ssl;
server_name example.com;
ssl_certificate /etc/nginx/ss.crt;
ssl_certificate_key /etc/nginx/ss.key;
location / {
proxy_pass https://host.docker.internal;
proxy_set_header Host $host;
}
}
}
and generating the key in a similar to this way:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ss.key -out ss.crt -config san.conf
// san.conf
[req]
default_bits = 2048
default_keyfile = ss.key
distinguished_name = req_distinguished_name
req_extensions = req_ext
x509_extensions = v3_ca
[req_distinguished_name]
countryName = Country Name (2 letter code)
countryName_default = US
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default = New York
localityName = Locality Name (eg, city)
localityName_default = Rochester
organizationName = Organization Name (eg, company)
organizationName_default = local.example.com
organizationalUnitName = organizationalunit
organizationalUnitName_default = Development
commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_default = local.example.com
commonName_max = 64
[req_ext]
subjectAltName = @alt_names
[v3_ca]
subjectAltName = @alt_names
[alt_names]
DNS.1 = local.example.com
DNS.2 = api-local.example.com