You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Jack Moffitt (JIRA)" <ji...@apache.org> on 2009/04/07 00:30:12 UTC
[jira] Created: (COUCHDB-321) Futon breaks when used with a reverse
proxy
Futon breaks when used with a reverse proxy
-------------------------------------------
Key: COUCHDB-321
URL: https://issues.apache.org/jira/browse/COUCHDB-321
Project: CouchDB
Issue Type: Bug
Components: Administration Console
Affects Versions: 0.9
Environment: Affects all platforms.
Reporter: Jack Moffitt
Priority: Minor
Attachments: futon.patch
It is often convenient to reverse proxy CouchDB at a url like /couch. Unfortunately, while CouchDB will work perfectly in this situation, Futon cannot handle it as jquery.couch.js uses absolute URLs to access all CouchDB functions.
I've attached a small patch that fixes this problem by:
1. Adding a urlPrefix attribute to $.couch which it uses to construct its URLs.
2. Adding logic to the futon.js constructor that figures out a suitable prefix and sets $.couch.urlPrefix to use this.
Any client code that makes use of $.couch will need to do something similar. Since only the application and the adminstrator will know what the prefix should be or how to deduce it, I didn't really know of a better way to handle this.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (COUCHDB-321) Futon breaks when used with a reverse
proxy
Posted by "Jan Lehnardt (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jan Lehnardt closed COUCHDB-321.
--------------------------------
Resolution: Fixed
Fix Version/s: 0.11
Applied in r904705.
> Futon breaks when used with a reverse proxy
> -------------------------------------------
>
> Key: COUCHDB-321
> URL: https://issues.apache.org/jira/browse/COUCHDB-321
> Project: CouchDB
> Issue Type: Bug
> Components: Futon
> Affects Versions: 0.9
> Environment: Affects all platforms.
> Reporter: Jack Moffitt
> Priority: Minor
> Fix For: 0.11
>
> Attachments: futon-proxy-fix.diff, futon.patch
>
>
> It is often convenient to reverse proxy CouchDB at a url like /couch. Unfortunately, while CouchDB will work perfectly in this situation, Futon cannot handle it as jquery.couch.js uses absolute URLs to access all CouchDB functions.
> I've attached a small patch that fixes this problem by:
> 1. Adding a urlPrefix attribute to $.couch which it uses to construct its URLs.
> 2. Adding logic to the futon.js constructor that figures out a suitable prefix and sets $.couch.urlPrefix to use this.
> Any client code that makes use of $.couch will need to do something similar. Since only the application and the adminstrator will know what the prefix should be or how to deduce it, I didn't really know of a better way to handle this.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COUCHDB-321) Futon breaks when used with a
reverse proxy
Posted by "Damjan Georgievski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805767#action_12805767 ]
Damjan Georgievski commented on COUCHDB-321:
--------------------------------------------
In my opinion it would be better if Futon only uses relative urls.
That way it'll not require any hacks nor admin configuration.
Here's a patch against 0.11.0b3fa3b673-git that implements this.
With this patch all except one tests pass when running directly on CouchDB.
Using Nginx as a proxy some of the tests fail regardless of if it's proxying on the root or on a usb-url, because Nginx rewrites url's (so any tests with test_suite_db%2Fwith_slashes fail). Also tests expecting the Server http header to be CouchDB fail too. The config.httpd.port == port check obviously fails too.
The oauth test is the only one that fails without the proxy, and it's because it creates externall urls (http://) to which this patch prepends ".." There are several ways to solve this, but I think .request should have an _external flag or something.
> Futon breaks when used with a reverse proxy
> -------------------------------------------
>
> Key: COUCHDB-321
> URL: https://issues.apache.org/jira/browse/COUCHDB-321
> Project: CouchDB
> Issue Type: Bug
> Components: Futon
> Affects Versions: 0.9
> Environment: Affects all platforms.
> Reporter: Jack Moffitt
> Priority: Minor
> Attachments: futon.patch
>
>
> It is often convenient to reverse proxy CouchDB at a url like /couch. Unfortunately, while CouchDB will work perfectly in this situation, Futon cannot handle it as jquery.couch.js uses absolute URLs to access all CouchDB functions.
> I've attached a small patch that fixes this problem by:
> 1. Adding a urlPrefix attribute to $.couch which it uses to construct its URLs.
> 2. Adding logic to the futon.js constructor that figures out a suitable prefix and sets $.couch.urlPrefix to use this.
> Any client code that makes use of $.couch will need to do something similar. Since only the application and the adminstrator will know what the prefix should be or how to deduce it, I didn't really know of a better way to handle this.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (COUCHDB-321) Futon breaks when used with a reverse
proxy
Posted by "Jack Moffitt (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jack Moffitt updated COUCHDB-321:
---------------------------------
Attachment: futon.patch
Patch attached for jquery.couch.js and futon.js.
> Futon breaks when used with a reverse proxy
> -------------------------------------------
>
> Key: COUCHDB-321
> URL: https://issues.apache.org/jira/browse/COUCHDB-321
> Project: CouchDB
> Issue Type: Bug
> Components: Administration Console
> Affects Versions: 0.9
> Environment: Affects all platforms.
> Reporter: Jack Moffitt
> Priority: Minor
> Attachments: futon.patch
>
>
> It is often convenient to reverse proxy CouchDB at a url like /couch. Unfortunately, while CouchDB will work perfectly in this situation, Futon cannot handle it as jquery.couch.js uses absolute URLs to access all CouchDB functions.
> I've attached a small patch that fixes this problem by:
> 1. Adding a urlPrefix attribute to $.couch which it uses to construct its URLs.
> 2. Adding logic to the futon.js constructor that figures out a suitable prefix and sets $.couch.urlPrefix to use this.
> Any client code that makes use of $.couch will need to do something similar. Since only the application and the adminstrator will know what the prefix should be or how to deduce it, I didn't really know of a better way to handle this.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (COUCHDB-321) Futon breaks when used with a reverse
proxy
Posted by "Damjan Georgievski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Damjan Georgievski updated COUCHDB-321:
---------------------------------------
Attachment: futon-proxy-fix.diff
attaching the fix.
ps. the nginx conf used for testing is:
server {
location / {
proxy_pass http://127.0.0.1:5984;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
location /db/ {
rewrite /db/(.*) /$1 break;
proxy_pass http://127.0.0.1:5984;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
> Futon breaks when used with a reverse proxy
> -------------------------------------------
>
> Key: COUCHDB-321
> URL: https://issues.apache.org/jira/browse/COUCHDB-321
> Project: CouchDB
> Issue Type: Bug
> Components: Futon
> Affects Versions: 0.9
> Environment: Affects all platforms.
> Reporter: Jack Moffitt
> Priority: Minor
> Attachments: futon-proxy-fix.diff, futon.patch
>
>
> It is often convenient to reverse proxy CouchDB at a url like /couch. Unfortunately, while CouchDB will work perfectly in this situation, Futon cannot handle it as jquery.couch.js uses absolute URLs to access all CouchDB functions.
> I've attached a small patch that fixes this problem by:
> 1. Adding a urlPrefix attribute to $.couch which it uses to construct its URLs.
> 2. Adding logic to the futon.js constructor that figures out a suitable prefix and sets $.couch.urlPrefix to use this.
> Any client code that makes use of $.couch will need to do something similar. Since only the application and the adminstrator will know what the prefix should be or how to deduce it, I didn't really know of a better way to handle this.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COUCHDB-321) Futon breaks when used with a
reverse proxy
Posted by "Mike Frawley (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709469#action_12709469 ]
Mike Frawley commented on COUCHDB-321:
--------------------------------------
Thanks Jack, I was having this same problem which was rather annoying.
I used this simpler logic to get the urlPrefix:
urlPrefix: window.location.pathname.split("/_utils/")[0]
I'm wondering if prepending the urlPrefix should be done in $.ajaxsetup() instead of every ajax call, which could make it a bit easier to manage.
> Futon breaks when used with a reverse proxy
> -------------------------------------------
>
> Key: COUCHDB-321
> URL: https://issues.apache.org/jira/browse/COUCHDB-321
> Project: CouchDB
> Issue Type: Bug
> Components: Administration Console
> Affects Versions: 0.9
> Environment: Affects all platforms.
> Reporter: Jack Moffitt
> Priority: Minor
> Attachments: futon.patch
>
>
> It is often convenient to reverse proxy CouchDB at a url like /couch. Unfortunately, while CouchDB will work perfectly in this situation, Futon cannot handle it as jquery.couch.js uses absolute URLs to access all CouchDB functions.
> I've attached a small patch that fixes this problem by:
> 1. Adding a urlPrefix attribute to $.couch which it uses to construct its URLs.
> 2. Adding logic to the futon.js constructor that figures out a suitable prefix and sets $.couch.urlPrefix to use this.
> Any client code that makes use of $.couch will need to do something similar. Since only the application and the adminstrator will know what the prefix should be or how to deduce it, I didn't really know of a better way to handle this.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COUCHDB-321) Futon breaks when used with a
reverse proxy
Posted by "Jack Moffitt (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709473#action_12709473 ]
Jack Moffitt commented on COUCHDB-321:
--------------------------------------
Mike, that looks great. Perhaps you could attach a modified patch that moved the logic to $.ajaxsetup?
> Futon breaks when used with a reverse proxy
> -------------------------------------------
>
> Key: COUCHDB-321
> URL: https://issues.apache.org/jira/browse/COUCHDB-321
> Project: CouchDB
> Issue Type: Bug
> Components: Administration Console
> Affects Versions: 0.9
> Environment: Affects all platforms.
> Reporter: Jack Moffitt
> Priority: Minor
> Attachments: futon.patch
>
>
> It is often convenient to reverse proxy CouchDB at a url like /couch. Unfortunately, while CouchDB will work perfectly in this situation, Futon cannot handle it as jquery.couch.js uses absolute URLs to access all CouchDB functions.
> I've attached a small patch that fixes this problem by:
> 1. Adding a urlPrefix attribute to $.couch which it uses to construct its URLs.
> 2. Adding logic to the futon.js constructor that figures out a suitable prefix and sets $.couch.urlPrefix to use this.
> Any client code that makes use of $.couch will need to do something similar. Since only the application and the adminstrator will know what the prefix should be or how to deduce it, I didn't really know of a better way to handle this.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.