WebFaction
Community site: login faq

I am trying to create a very simple proxy to allow Ajax apps to load data from a different domain. I have this .htaccess which worked perfectly in a php/static webapp I did a year ago and put in the root of the website:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysite.com$
RewriteRule ^(.*)$ http://myothersite.com/$1 [P]

I thought it was basically a suitable solution also in this case, so I tried to change it to something like this (after many failures):

RewriteEngine on
RewriteRule ^(.*)$ https://google.com/ [P]

And put it in a subfolder of an older (few years ago) webapplication but I get 505. Looks like it tries to look for the path in the same domain. Maybe in this old webapplication the module mod_proxy_http is not loaded? I got a warning mentioning this in one of the log files.

Thanks for any opinion!

asked 19 Jan '13, 09:08

gabon
1548
accept rate: 0%


A 301 redirect would not normally work for JavaScript cross domain checking, but mod_proxy would. In order to use mod_proxy you would have to make a custom apache stack. It would be easier to write a server-side script which fetched the JSON you require and than re-post it on behalf of the current domain.

permanent link

answered 19 Jan '13, 17:37

johns
5.4k312
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×75
×25
×6

question asked: 19 Jan '13, 09:08

question was seen: 3,341 times

last updated: 19 Jan '13, 17:37

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM