Welcome! Log In Create A New Profile

Advanced

Re: Serving XHTML as HTML to MSIE browsers in NginX

April 06, 2009 05:48AM
Maxim Dounin Wrote:
-------------------------------------------------------
> Hello!
>
> On Mon, Apr 06, 2009 at 03:39:13AM -0400,
> elliottcable wrote:
>
> > Okay, I talked to the nice people in the #NginX
> IRC room a bit (thanks "merlincorey" and "Damn"!).
> From a more careful reading of the NginX wiki's
> documentation, it appears that this should be
> legal:
> >
> >
> http://github.com/elliottcable/server-configuratio
> n/blob/ad48f0b73ea8e2d33fc97bba60ddad2a4abca064/ng
> inx/includes.conf#L7-12
> >
> > Here's the reasoning. The wiki declares that the
> `types {}` declaration is legal within a `location
> /…/ {}` declaration: http://tr.im/ijbz?nginx -
> it also declares that the inside of an `if () {}`
> declaration should inherit context from outside
> the `if`: http://tr.im/ijbK?nginx (to quote,
> "Configuration inside directive if is inherited
> from the previous level."). Therefore, having a
> `types` declaration inside an `if` inside a
> `location` should be legal.
>
> Directives allowed within if() blocks has context
> "if" or "if in
> location" explicitly listed in their
> documentation. Directives
> types and default_type aren't allowed inside
> if's.
>
> > Unfortunately. with the configuration file as
> linked above, I can't launch NginX; I get an
> "emergency" level error about syntax that kills it
> on launch.
> >
> > Is this a bug, then? Or is the documentation
> wrong? In either case, what can I do to get my
> server fixed to (im)properly serve XHTML to MSIE?
>
> Try something like this:
>
> location ~ \.xhtml$ {
> error_page 405 = @html;
>
> if ($http_user_agent ~* MSIE) {
> return 405;
> }
> }
>
> location @html {
> types {};
> default_type text/html;
> }
>
> Maxim Dounin
>
> >
> > Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,839,842#msg-842
> >
> >

That seems like … a horrid hack. Is there seriously no better way around this?
Subject Author Posted

Serving XHTML as HTML to MSIE browsers in NginX

elliottcable April 06, 2009 12:35AM

Re: Serving XHTML as HTML to MSIE browsers in NginX

elliottcable April 06, 2009 03:39AM

Re: Serving XHTML as HTML to MSIE browsers in NginX

Maxim Dounin April 06, 2009 05:06AM

Re: Serving XHTML as HTML to MSIE browsers in NginX

elliottcable April 06, 2009 05:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 64
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready