当前位置: 动力学知识库 > 问答 > 编程问答 >

apache - .htaccess send status code and header with condition

问题描述:

I need to send a status code and some headers when REQUEST_METHOD = OPTIONS

My current code:

RewriteCond %{REQUEST_METHOD} ^OPTIONS$

RewriteRule .* - [L,R=204,ENV=moptions:true]

Header set Access-Control-Allow-Headers "Authorization" env=moptions

Header set Access-Control-Allow-Methods "GET, POST, PUT, DELETE" env=moptions

Without L,R=204 the headers are sent.

Can I send status code and headers?

I tried with env=REDIRECT_moptions, but it doesn't work.

  • Is it possible to set headers conditionaly?
  • Conditionally setting cache headers in apache

分享给朋友:
您可能感兴趣的文章:
随机阅读: