Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 465
Daniel Haddon Avatar asked Oct 05 '16 15:10

Daniel Haddon


2 Answers

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>
like image 139
Tom Gerken Avatar answered Sep 30 '22 04:09

Tom Gerken


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>
like image 27
Daniel Haddon Avatar answered Sep 30 '22 04:09

Daniel Haddon