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

Whitelabel page is not displayed in IE 11 in Compatibility Mode #3633

Closed
trung opened this issue Jul 31, 2015 · 3 comments
Closed

Whitelabel page is not displayed in IE 11 in Compatibility Mode #3633

trung opened this issue Jul 31, 2015 · 3 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@trung
Copy link

trung commented Jul 31, 2015

In IE11, Tools -> Compatibility View Settings -> Add localhost in the list
Visit http://localhost:8080/foo

It displays IE 404 instead of Spring Boot Whitelabel page.

This is due to the Accept header for Compatibility mode contains:
application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*

Hence the BasicErrorController returns the ResponseEntity instead of the "error" view.

Per https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation

Not sure how best we can fix this, probably declare one more content type in the "produces" value in BasicErrorController#errorHtml?

@bclozel
Copy link
Member

bclozel commented Jul 31, 2015

Given the current method signatures, I don't know what we could do to fix this...

    @RequestMapping(value = "${error.path:/error}", produces = "text/html")
    public ModelAndView errorHtml(HttpServletRequest request) {

    @RequestMapping(value = "${error.path:/error}")
    @ResponseBody
    public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {

Mimetypes application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword are all application/file related and not suitable for HTML output.
Writing HTML in response of */* would work, but this would also mean that content negotiation is broken for JSON, XML, etc.

For that very specific use case, I'd try to write a Servlet Filter that adds a text/html mimetype to HTTP requests coming from that particular client. It will be a problem for all endpoints anyway.

@trung
Copy link
Author

trung commented Aug 3, 2015

How about reversely provide explicit produces for JSON/XML content negotiation and default returned content type is the white label page?

Or is there a way to create error controller programmatically? We can externalized content negotiation for whitelabel page and the ResponseEntity

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 30, 2015
@bclozel
Copy link
Member

bclozel commented Jan 9, 2017

You can configure the content negotiation to your liking (how it's operated, default content type, etc), but it's likely to break things for all other clients.

If you'd like to do that for this particular client, then the Servlet filter is in my opinion still the best choice.

@bclozel bclozel closed this as completed Jan 9, 2017
@bclozel bclozel added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants