2

I need a script to perform a POST request to a different sub-domain than the one the page loads from, e.g. load data from domain.com and perform the AJAX POST to post.domain.com.

I've read about some alternatives that work for mainly for GET or POST with simple form data, but in this case I'll be posting a file (can be quite large).

I control the server, and both the page and the target are under the same domain. Is there any way to do this with JS/Iframes or do I have to resort to Flash/Flex?

As a side question, does mod_proxy for apache redirect a POST when the HTTP request is fully read (at apache) or it starts redirecting traffic (like a TCP tunnel) as soon as the headers are read?

biasedbit
  • 2,860
  • 4
  • 30
  • 47
  • This is an absurdly difficult thing to do. `curl` is fine. The server responds with a 201. I feel like I'm being "protected" into submission. I _want_ anyone to be able to post from anywhere – Peter Klipfel May 04 '16 at 18:05

2 Answers2

1

For requesting data from another subdomain you could look at JSONP

For posting files you can definitely use iframes.

This is a good tutorial: http://www.openjs.com/articles/ajax/ajax_file_upload/

0x6A75616E
  • 4,696
  • 2
  • 33
  • 57
1

Maybe Why am I getting an OPTIONS request instead of a GET request? can help you.

Community
  • 1
  • 1
gfelisberto
  • 1,655
  • 11
  • 18
  • This is exactly it; implemented the OPTIONS response at server side and it's working like a charm! With no ugly hacks :D – biasedbit Apr 20 '11 at 17:12