Hello,
I need to use dynamic subdomains, for multiple user session, so i have already a domain, is working well, when i use dynamic subdomain for exemple user1.domain.com i have a white screen with this error : Loading of the module at ... was blocked due to a forbidden MIME type ("text/html"). , The stylesheet ... was not loaded because its MIME type, "text/html", is not "text/css".
I use rewiteRules in OpenLiteSpeed like this :
# Redirect HTTP to HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Exclude request to /api/ and static files
RewriteCond %{REQUEST_URI} !^/api/
RewriteCond %{REQUEST_URI} !\.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|otf|map)$ [NC]
# Handle dynamic subdomains in the form of user<number>.domaine.com
RewriteCond %{HTTP_HOST} ^user([0-9]+)\.domaine\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/api/
RewriteCond %{REQUEST_URI} !\.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|otf|map)$ [NC]
RewriteRule ^(.*)$ /index.html [L,QSA]
# Exclude the homepage (domaine .com) from being rewritten
RewriteCond %{HTTP_HOST} ^domaine\.com$ [NC]
RewriteRule ^(.*)$ - [L]
# Rewrite all other requests to index.html (for client-side routing in a SPA)
RewriteRule ^(.*)$ /index.html [L,QSA]
the domain.com working good, it's only subdomain, the front api is in React with Vite. I think it's a problem with static files but i don't find the solution...
Can you help me?
Thank you
I need to use dynamic subdomains, for multiple user session, so i have already a domain, is working well, when i use dynamic subdomain for exemple user1.domain.com i have a white screen with this error : Loading of the module at ... was blocked due to a forbidden MIME type ("text/html"). , The stylesheet ... was not loaded because its MIME type, "text/html", is not "text/css".
I use rewiteRules in OpenLiteSpeed like this :
# Redirect HTTP to HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Exclude request to /api/ and static files
RewriteCond %{REQUEST_URI} !^/api/
RewriteCond %{REQUEST_URI} !\.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|otf|map)$ [NC]
# Handle dynamic subdomains in the form of user<number>.domaine.com
RewriteCond %{HTTP_HOST} ^user([0-9]+)\.domaine\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/api/
RewriteCond %{REQUEST_URI} !\.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|otf|map)$ [NC]
RewriteRule ^(.*)$ /index.html [L,QSA]
# Exclude the homepage (domaine .com) from being rewritten
RewriteCond %{HTTP_HOST} ^domaine\.com$ [NC]
RewriteRule ^(.*)$ - [L]
# Rewrite all other requests to index.html (for client-side routing in a SPA)
RewriteRule ^(.*)$ /index.html [L,QSA]
the domain.com working good, it's only subdomain, the front api is in React with Vite. I think it's a problem with static files but i don't find the solution...
Can you help me?
Thank you