开发者

Does setting up a CNAME in the DNS record allow for POST'ing to that server's pages?

I'm building a Shopify website and I'm trying to create a simple "Contact Us" page that allows the user to POST their comments (e.g. name, email, comments). The Shopify website is hosted (as all Shopify accounts are) but I can set up a CNAME from my domain to point the Shopify hosted pages (that way I have a vanity URL).

I'm wondering, will this enable me to POST directly from the Shopify hosted pages to a script on my server?

Example: The Shopify pages are at: http://myawesomestore.shopify.com On my contact-us page: http://myawesomestore.shopify.com/pages/contact-us/ I want to POST to a script on my domain (where I c开发者_运维百科an store in a database): www.my-domain.com/contact-us.php

If I cannot do this, what is the best solution for posting from a hosted solution to an owned solution (i.e. I cannot set up a proxy on their domain to POST to mine).

I hope this makes sense, I'm still very much a novice and there are just too many fundamentals here to comprehend before I could logically build this solution myself.

Thank you all so much in advance!

Cheers, Rob


POSTing a Form to any URL on the internet is never a problem. It doesn't matter if it's on the same domain or a different domain.

You can set up a contact form on your Shopify store and have it send a POST request to any URL where your custom application is listening to.

So the short answer is: This is absolutely no issue, just go ahead and add the form to your shop!

Some confusion on the topic might be caused by "Cross Domain AJAX". If you're doing your POST requests via Javascript then yes, it is only possible to do so if the target URL is on the same domain as the source that is sending the request. See also http://snook.ca/archives/javascript/cross_domain_aj

Hope this clears this up!


No, you can't just use a CNAME in most cases. The CNAME will forward to the target server and if it's using virtual hosting, it uses the domain name to figure out how to handle the request. If they have it set up so the server only uses one domain name, it may be set up without a virtual host, which will allow this to work, but you don't really want your script to be dependent upon their server setup.

If you need to have it look like your url, I'd just put it inside a frame.


A form can POST to any destination on the internet that the user's browser has access to.


you don't need a cname, if you can set up a html form you can post it to any url on the net
...
post is a standard http header, you cant really have a webserver and it not accept post. its up to the site posted to, to check the source of the post and decide what to do with the data

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜