Search code examples
c#asp.net-mvcazureapplepay

Azure websites .well-known route becomes inaccessible


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.


Solution

  • 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>