Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do I prevent a location from being matched by the ssl rewrite?

server {
        listen      80;
        server_name example.net;

        location = /feeds/ {
                break;
        }

        rewrite     ^   https://$server_name$request_uri? permanent;
}
server {
        listen 443;
        ...
share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Put the rewrite in a location block. nginx only applies one location block at each level, so if /feeds/ is matched the other block won't be applied:

location / {
    rewrite     ^   https://$server_name$request_uri? permanent;
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.