Using proxy instead of redirect with htaccess rewriteRule

I am developing a webapp and for static files I just use apache in localhost

and the backend is on a couchdb instance running on localhost:5984

.

The webapp is constantly interacting with files from the backend. So, what happens when trying to test on apache, all file requests are not being localhost:5984

blocked due to cross-domain policy, so the only way to get this working is to start the browser with the checkboxes checked to ignore this.

But again I get stuck when trying to test an app on a mobile phone like an ipad or iphone.

I currently have this in my file .htaccess

.

RewriteEngine  on

# these are 302 http redirections instead of serving as a proxy
RewriteRule auth http://localhost:5984/auth [L]
RewriteRule db/([\s\S]+) http://localhost:5984/db/$1 [L]
RewriteRule send/([\s\S]+) http://localhost:5984/send/$1 [L]

# these are just redirections to static files and work great
RewriteRule ^([a-z/.]+) _attachments/$1 [L]
RewriteRule ^$ _attachments/ [L]

      

As you can see, I really don't know how to deal with the Apache configuration, unfortunately. But what is happening now is that for some of these rules, apache is just redirecting the page instead of serving it as a proxy, which causes a cross-domain issue.

Also in the first rule auth

I am sending POST and DELETE requests which, as a redirect instead of a proxy, will not pass the POSTED data through.

So, I would like to activate some function (if it exists) that will force apache to just render the page as it did in the localhost domain, rather than redirect it. (I called this a proxy, but it may not even be the correct term, sorry for any mistake made with nomenclatures).

Is it possible to achieve such an action? thanks in advance

+3


source to share


1 answer


Take a look at these links / options:



+3


source







All Articles