Redirect to new domain, missing Post Value - apache

My old mobile app is using digitalocean dedicated ip to access the API from my website.
Now I have new domain for my website, but for some reason I cannot change the ip in my app to the new domain im using now.
When my app sending POST request to the API, the POST request is lost and my API can't get the value. I think its because the redirect process from the ip to domain. Is there a way to access my API from the old ip without losing POST value?

If you are externally redirecting the POST request with a 301 or 302 status then user-agents will usually issue a GET request on the second/redirected request, so your POST data is lost.
For user-agents to preserve the request method through the redirect then you need to issue a 307 (Temporary) or 308 (Permanent) HTTP status code instead.
Reference:
MDN docs - 307 Temporary Redirect
MDN docs - 308 Permanent Redirect

Related

HTTP 302 on /connect Soundcloud API

why when I go to https://soundcloud.com/connect?client_id=MY_ID&redirect_uri=http://MY/FULL/URL/&response_type=code&scope=non-expiring&consumer_key=MY_ID it redirects me back to my website? On localhost (dev API) it works.
That sounds like the correct behaviour - once you've successfully authenticated, you should be redirected back to the redirect_uri. Is this working or not?

GCM URL and 302 redirect response

My Question is regarding GCM URL and 302 redirect response.
When I do curl -v url = https://gcm-http.googleapis.com/gcm/send, I get a 302 response with a new URL populated in location header. My question is, why can't I use the new URL received in 302 redirect always? What is the reason for Google responding with 302 redirect? I would really appreciate detailed explanation.
Many Thanks,
Sushil
Based from this article, error 302 means "Resource temporarily located elsewhere according to the Location header." This seems to be a previously reported issue (with GCM):
https://groups.google.com/forum/#!topic/android-gcm/WwEg6buc-K0
IO Exception while accessing Google Cloud message?
Suggested action is to re-run the request to the provided (temporary, alternate) URL.

Browsing to IP and port number displaying raw html 400 bad request

Setup HTTPS and a redirect from HTTP to HTTPS. Browsing to just the IP address with or without HTTP and HTTPS works great and redirects perfectly. But while browsing to X.X.X.X:443 the web server is displaying the 400 bad request in raw html. Can I either disable the 400 bad request or be able to redirect those requests to HTTPS? Please help. Thanks!
If such is possible, it would depend on which web server you are using and you didn't specify that. However...
Doing so would actually be a bad idea as it would encourage people to use HTTP (no S) to connect to your secure server. In doing so, they would send their request in plaintext. If the system just returned a "301 Moved Permanently" to the HTTPS url, the second request (with reply) would be protected but you still would have leaked the request to a potential attacker during the first attempt.

Sending a 307 Redirect using Apache before receiving the full POST payload

Is it possible to send a 307 redirect header before receiving the full POST payload?
I've a website which has to redirect a POST request to a third level domain; everything work fine except the fact that when a large file is uploaded it takes nearly twice the time because the 307 is sent only after all POST data as been (uselessly) acquired by the website.
Thanks!

HTTP 307 Redirects -- Supported By Most Browsers Since IE6?

So evidently in 2010, Matt Cutts at Google revealed in an interview, along with a follow-up email exchange after the interview, that Google deducts page rank if you use domain-to-domain HTTP status 301 redirects. In other words, if you have examples.com and purchase example.com that redirects with an HTTP status 301 redirect to examples.com, Google has admitted that they will usually deduct PR for that.
Okay, so what's left is HTTP status 302 and HTTP status 307 redirects. They say on wikipedia that 307 is the new way, and that HTTP status 302 was "bastardized" and not really the right way to do a redirect. Trouble is -- do most browsers since IE6 support the HTTP status 307? See, I don't have an IE6 browser around anymore to test.
So the question is -- if we need to start using HTTP status 307 redirects, will it work in browsers released since IE6, as well as the IE6 browser?
I made the decision to use a 302 redirect, and here's why:
Google certainly can't penalize the entire web for not using 307 redirect because, well, hardly anyone knows about it. Most products you can download and install still use 301 or 302 redirect. Or, if they simply use a header('Location: x') call, that defaults to a 302 redirect anyway.
Google has admitted (in the sources I provided in the original post) that 301 redirects are penalized if you're using them for domain-to-domain redirects.
If I want the largest acceptance in the browsers, the HTTP 302 status code is going to be more preferable at least for now instead of the HTTP 307. The HTTP 307 is the future, however, according to what I read. However, HTML5 is still the future too and as of 2012 it's still not ready yet.