Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accessing hoodie remotely #857

Open
meecect opened this issue Jun 21, 2018 · 6 comments
Open

accessing hoodie remotely #857

meecect opened this issue Jun 21, 2018 · 6 comments

Comments

@meecect
Copy link

meecect commented Jun 21, 2018

I have a hoodie app set up locally on my laptop and it is working fine, but the same app running on my staging server throws a lot of errors in the console related to pouchdb hitting 404's. What ports need to be opened for hoodie to work? Does the client need a port to talk directly to couchdb as the docs suggest?

another wrinkle...in my staging environment I am using apache to reverse proxy for the app. So on the staging box hoodie is running on 8080, but from my laptop I am connecting on port 80, and then apache proxies that to port 8080. Files served out of /public are working fine, and I can add content to the store, but it doesn't appear to be sync'ing back.

If I open the same site in an incognito window, for example, I dont see the same content which leads me to believe that the data is not syncing.

The specific error in the console is:
client.js:21766 GET http://tid-web-app-s1.vacation.tomy.com/hoodie/store/api/user%2Frt58y9l/ 404 (Not Found)

it says this too:
The above 404 is totally normal. PouchDB is just detecting if the remote exists.

which I understand is sometimes normal, but I get a huge number of them repeated.

Plus with the same code base (same user and pass) I don't get the same store data from a normal chrome window and an incognito window.

Contrast that with my experience with the same code running locally, I can enter items in my app in a chrome window and then if I open an incog window to the same local app, I see the items there.

Any idea what might be going on?

@meecect
Copy link
Author

meecect commented Jun 21, 2018

As an update, if I run my app on my staging server and create an SSH tunnel to it so that I am tunneling my laptop port 8080 across ssh to my staging box and then to port 8080 (localhost at that point) then my app works.

So it seems to have something to do with the apache proxy or a config option in hoodie.

@gr2m

This comment has been minimized.

@gr2m gr2m closed this as completed Jun 22, 2018
@gr2m

This comment has been minimized.

@gr2m gr2m reopened this Jun 22, 2018
@gr2m
Copy link
Member

gr2m commented Jun 22, 2018

can you try to run the server with hoodie_address=0.0.0.0?

@meecect
Copy link
Author

meecect commented Jun 22, 2018

by adding this to my apache config, I was able to get a little further:

AllowEncodedSlashes NoDecode

No, I don't get the 404's anymore. It seems Apache mod_proxy was not playing nice with encoded URLs.

However, now I get this:

CustomPouchError {statusCode: 401, error: "Unauthorized", status: 401, name: "Unauthorized", message: "getCheckpoint rejected with ", …}

So, I think it is a similar problem. My theory is that apache mod_proxy is just stripping off the Authorization header in the original request.

hmm, no, I just ran tcpflow and I can see an authorization header in the request going to hoodie. I'm not sure what it is now.

@gr2m
Copy link
Member

gr2m commented Jun 22, 2018

401 might mean that the session was invalidated. Try to hoodie.account.signIn() to get a new session

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants