Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How to overwrite default Content-Type in nginx? Currently when I request 01.dae file, there's

Content-Type: application/octet-stream;

And I want it to be

Content-Type: application/xml;

I tried something like

location ~* .dae$ {
  types { };
  default_type application/xml;
}

and

location ~* .dae$ {
  add_header Content-Type application/xml;
}

but nothing works.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

In case you have no file extension:

location ~ something {
   default_type application/xml;
}

Nginx docs for default_type

In case you are setting up let's encrypt certificate with a client which creates http server: How to use golang lego let's encrypt client behind nginx?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...