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

I recently implemented the following virtual host settings in my apache2.conf file:

   # force HTTPS
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteCond %{REQUEST_URI} !^/path1.html
    RewriteCond %{REQUEST_URI} !^/path2.html
    #RewriteCond %{REQUEST_URI} ^/path3.html
    #RewriteCond ${REQUEST_URI} !^/index.html
    RewriteRule . https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]

One of the services that I'm integrating with communicates with my service using HTTP POST. However, they noticed that since implementing this config and making a call to http://, when my server forces the call to be made over https, the request type is changed from POST to GET and the POST messages are dropped. I was wondering if there was a way to update this code to force the original POST/GET method to be kept intact.

share|improve this question

1 Answer 1

The calling service is broken, but there's not much you can do about it unless you can fix the caller. From RFC 2616:

Note: When automatically redirecting a POST request after receiving a 301 status code, some existing HTTP/1.0 user agents will erroneously change it into a GET request.

Your options are:

  • Fix the calling service so that it follows redirects properly.
  • Have the calling service use the https URL.
  • Don't redirect http to https for this service.
share|improve this answer
    
Just don't redirect HTTP 1.0 requests. You can safely redirect HTTP 1.1 requests. –  David Schwartz Jan 2 '13 at 2:45
    
Just for curiousty, any idea as to which user agents this happens on? –  mdpc Jan 2 '13 at 5:18
    
@mdpc No idea. It's not one of the things I've been tracking. –  Michael Hampton Jan 2 '13 at 15:05

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.