angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Angular 6 cannot serve index.aspx files in IE 11 anymore, downloads it instead

Open raberana opened this issue 8 years ago • 6 comments

Versions

Angular CLI: 6.0.7
Node: 9.4.0
OS: win32 x64
Angular: 6.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.7
@angular-devkit/build-angular     0.6.7
@angular-devkit/build-optimizer   0.6.7
@angular-devkit/core              0.6.7
@angular-devkit/schematics        0.6.7
@angular/cli                      6.0.7
@ngtools/webpack                  6.0.7
@schematics/angular               0.6.7
@schematics/update                0.6.7
rxjs                              6.2.0
typescript                        2.7.2
webpack                           4.8.3

Repro steps

  • Create new project using ng new
  • Rename index.html to index.aspx
  • Run project in IE 11: ng serve --host 127.0.0.1 --port 4200 --open

Observed behavior

  • A file gets downloaded which contains the content of index.aspx
  • Content-type is null compared to text/html when using index.html

WHEN SERVING AN ASPX FILE: aspx_response

WHEN SERVING AN HTML FILE: html_response

Desired behavior

Before, there's no problem in serving index.aspx files so we hope it would stay the same

Sample downloaded file when serving index.aspx: 01TIVXF0.zip

Just to be clear, the content of the index.aspx file is just pure HTML. There's no ASPX syntax there. We renamed the index file so that a custom DLL module that we have can be ran against it when we host it in IIS. But there's no ASPX syntax there, just pure HTML.

I just want to know what changed and maybe I can check myself on how we could have a workaround for this if its really meant this way.

raberana avatar Jun 04 '18 14:06 raberana

An aspx file is not an html file so the described behavior appears fairly appropriate. aspx files are intended to be processed and then served by ASP.net not delivered directly to the web browser.

clydin avatar Jun 04 '18 15:06 clydin

But we were able to serve aspx files before with no problem directly from the browser, with Angular 5 of course.

raberana avatar Jun 04 '18 15:06 raberana

If they did then it was unintentional. A non-HTML file should not be served with a mime type of text/html as the file is not HTML. A web browser also cannot understand ASPX syntax (it is a different file format) and even if it did the output would not be representative of the actual ASP.net server output.

clydin avatar Jun 04 '18 15:06 clydin

Just to be clear, the content of the index.aspx file is just pure HTML. There's no ASPX syntax there. We renamed the index file so that a custom DLL module that we have can be ran against it when we host it in IIS. But there's no ASPX syntax there, just pure HTML. You can check the zip file and see that it is only HTML.

raberana avatar Jun 04 '18 15:06 raberana

I can confirm @clydin's assessment: if .aspx files were being served with a MIME of text/html it was unintentional.

We didn't intentionally change anything about this behaviour but it's not something we want to special case. Faking MIME types can have unintended consequences, and keeping a whitelist of types we should fake is hard to maintain.

If this file is truly html when being served via ng serve, and you want to be served as text/html, I would advise you to actually use the .html extension for it.

filipesilva avatar Jun 11 '18 15:06 filipesilva

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.