Hello everyone,
I’m using Caddy to host a couple Angular2 applications, so far, without any issues or, at least, major issues.
However, I’m trying to configure the Universal App Links files (assetlinks.json for Android, apple-app-site-association for iOS) but I’m having some issues here.
The files are being served and I can see them, however, I’ve noticed that when running Caddy locally the files will come up as application/json
but when being served from the production server, these files have mime text/plain
.
In order to solve this, I’ve tried a few different approaches, being the most recent one this file:
http://{$APP_HOST} {
redir 301 {
if {scheme} is http
https://{host}{uri}
}
}
https://{$APP_HOST} {
gzip
tls {$APP_CRT} {$APP_KEY}
header / Vary "Accept-Language, Cookie"
rewrite {
if {file} not favicon.ico
if {file} not manifest.json
if {file} not service-worker.js
if {path} not_has /assets
to {path} {path}/ /index.html
}
root {$APP_ROOT}
log stdout
errors stdout
}
https://{$APP_HOST}/.well-known/ {
gzip
tls {$APP_CRT} {$APP_KEY}
header /.well-known Content-Type application/json
mime .* application/json
root {$APP_ROOT}/.well-known
log stdout
errors stdout
}
First, I’d just like to have the .well-known
path in the same definition as the https
host. Tried using rewrites and proxy but none of those solutions seemed to work. I’m always redirected into index.html
.
But, the worst part is that I’ve been unable to explicitly declare the file types to be application/json
nor the mime types.
For context, these files are placed at /var/www/html/.well-known
dir, where there are two files: assetlinks.json
and apple-app-site-association
(notice the lack of extension, as per Apple’s requirements ).
So,
1 - How come there are differences in type from running Caddy locally or on prod server?
2 - And why can’t I force the type to be json for all files under .well-know
?
3 - How can I avoid defining a “new site” just for the .well-known files?
I really need this to work flawlessly.
Best Regards,
Celso Santos