Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Getting 401 error in chrome console when connecting to couchdb but works normally with firefox #4773

Unanswered
prog7707 asked this question in Q&A
Discussion options

I am trying to connect a webapp to my couchdb server that is hosted on a secure domain https://mydomain.com.
My cors config:
[cors]
credentials = true
origins = *
headers = X-Couch-Id, X-Couch-Rev
methods = GET,POST,PUT,DELETE,OPTIONS
max_age = 3600
[couch_httpd_auth]
same_site = lax
allow_persistent_cookies = true


when i put same_site=none , i cant login to https://mydomain.com/_utils but changing it to lax fixed that.
But still the app is unable to login to couchdb when using chrome, i tried serveral chrome on different pc and got same error. And with Firefox everything works normally.
In nginx i have these config:
server {
listen 80 default_server;
server_name mydomain.com;
location / {
proxy_pass http://localhost:5984;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' 'https://web.myapp.app'; # Set to your application's origin
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Authorization';
add_header 'Access-Control-Allow-Credentials' 'true'; # Allow credentials
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}

}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

can any one help please.

You must be logged in to vote

Replies: 2 comments

Comment options

Try setting cookie_domain?

You must be logged in to vote
0 replies
Comment options

I just tried this and aame issue. It didnt work.
...
On Sun, 24 Sept 2023, 1:36 pm Robert Newson, ***@***.***> wrote: Try setting cookie_domain <https://docs.couchdb.org/en/stable/config/auth.html#chttpd_auth/cookie_domain> ? — Reply to this email directly, view it on GitHub <#4773 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ALEYOQOV65AYV66KFLKLUODX4AEMFANCNFSM6AAAAAA5ERFEVY> . You are receiving this because you authored the thread.Message ID: ***@***.***>
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /