Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IIS and Files without extension, probably a easy solution #35

Closed
zoTT5301 opened this issue Aug 8, 2019 · 1 comment
Closed

IIS and Files without extension, probably a easy solution #35

zoTT5301 opened this issue Aug 8, 2019 · 1 comment

Comments

@zoTT5301
Copy link

zoTT5301 commented Aug 8, 2019

I was looking for a suitable solution to automate the IIS-Configuration to support files (mime-types) without extension. I have found a way to do this with powershell and don't have to config that by GUI but: (for me) the solution in the comments dit not work.
I think that was because there is also a handler configuration change neccessary.

After a lot of reading i found a probably better solution: Place a web.config into the challenge directory.
You can copy it from elsewhere or create ist with Set-Content.
At the end the web-config has do exist next to the challenge file before the Check if the challenge is readable ( Invoke-WebRequest $challenge.Data.AbsoluteUrl)
That works for me (Server2016 / IIS10 )without the need of a GUI

Content of web.config (sorry for the format):
<?xml version = "1.0" encoding="UTF-8"?> <configuration> <system.webServer> <staticContent> <mimeMap fileExtension="." mimeType="text/plain" /> <mimeMap fileExtension=".*" mimeType="text/plain" /> </staticContent> <handlers> <clear /> <add name="StaticFile" path="*" verb="*" type="" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" scriptProcessor="" resourceType="Either" requireAccess="Read" allowPathInfo="false" preCondition="" responseBufferLimit="4194304" /> </handlers> </system.webServer> </configuration>

@glatzert
Copy link
Collaborator

If you want to add it via Powershell, you can probably use something like this:

PS C:\> Get-IISConfigSection -SectionPath "system.webServer/staticContent" | Get-IISConfigCollection -CollectionName "mimeMap" | New-IISConfigCollectionElement  -ConfigAttribute @{"fileExtension" = "."; "mimeType" = "text/plain"}

I'll test and describe it in the README.md when i could test it on some machine.

@zoTT5301 zoTT5301 closed this as completed Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants