I am trying to make the file:
.well-known/apple-developer-merchantid-domain-association
accessible via my Azure website. I have added this to the route config:
routes.MapRoute(
name: "ApplePay-MacOS",
url: ".well-known/apple-developer-merchantid-domain-association",
defaults: new { controller = "Home", action = "WellKnownApplePay" });
Which points to a controller action that gives the file out.
Now everything works when I test it on my local IIS and IIS Express but when I upload it to azure it just isn't accepting the dot "." character in the URL. If I remove it then it works and the file downloads after it has been published to azure. I need it to work with the dot as that is what apple pay requires of my site.
I was able to solve this using a different approach. I stopped trying to write routing for the certificate and added a web.config into the directory per Peter Hahndorf's answer here: IIS: How to serve a file without extension?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension="." mimeType="text/xml" />
</staticContent>
</system.webServer>
</configuration>
I found the answer! Thanks to Tom's answer.
You can indeed add the mimemap to the web config to fix the issue. But instead of putting the mimeType="text/xml" you need to use mimeType="application/octet-stream" to serve the raw apple-developer-merchantid-domain-association file and not serve it as text (which the server doesnt want to do).
So the answer is to add this to the system.webserver node in webconfig:
<staticContent>
<mimeMap fileExtension="." mimeType="application/octet-stream" />
</staticContent>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With