[nodebb-plugin-blog-comments] Blog Commenting Engine (Ghost, Wordpress widget)
-
@hek @Jacob-Moen @julian please look at this :
https://github.com/psychobunny/nodebb-plugin-blog-comments/pull/36With a little copy and paste the code Mr. Sohrab, this feature was added to the plugin.
The plugin, by sending a xhs request received information from Wordpress or ghost as json file, now we have our information directly from the server initialization.
-
A couple of things I don't get.
- Will the post/tags/etc be updated in NodeBB every time someone views the commenting sections on the external site?
- Who will be the author of the post in NodeBB?
-
Hello,
As I posted almost a month a go I have a blog running on ghost and I am trying to use this plugin as a commenting engine on it. I can enable the plugin on few of the posts but not all of them. When is not working I am getting on the browser side the following:
and on the logs I can see the following message:
16/12 15:28 [1593] - warn: [nodebb-plugin-blog-comments] Origin (undefined) does not match hostUrls: http://z0z0.me
Is there anything I can do to get this work?
Regards and thanks in advance.
Peter -
@Peter-Zoltan-Keresztes yes you should set
resp.http.Access-Control-Allow-Origin = "http://z0z0.me";
in your web server ( Nginx or ht-access of Apache ) or vcl_backed of varnish -
set resp.http.Access-Control-Allow-Origin = "http://z0z0.me";
That is syntax in varnish vcl for others googlehow set Access Control Allow Origin
-
@sanatisharif said:
resp.http.Access-Control-Allow-Origin = "http://z0z0.me";
nginx does not seam to like it.
-
@sanatisharif said:
set resp.http.Access-Control-Allow-Origin = "http://z0z0.me";
That is syntax in varnish vcl for others googlehow set Access Control Allow Origin
@Peter-Zoltan-Keresztes in Nginx you should use different syntax for setting allow origin.
-
My nginx config looks like this:
server { listen 80; server_name z0z0.me; #charset koi8-r; access_log /var/log/nginx/z0z0/access.log main; error_log /var/log/nginx/z0z0/error_log; location / { add_header 'Acces-Control-Allow-Origin' '*'; proxy_set_header X-Real-IP $remote_addr; proxy_set_header HOST $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:2369; proxy_redirect off; } location /comments { proxy_set_header X-Real-IP $remote_addr; proxy_set_header HOST $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:4567; proxy_redirect off; } }
I am still getting the same error message.
-
@Peter-Zoltan-Keresztes said:
add_header 'Acces-Control-Allow-Origin' '*';
change this
add_header 'Acces-Control-Allow-Origin' '*';
to
add_header 'Acces-Control-Allow-Origin' 'http://z0z0.me';
-
@sanatisharif I did that. the Access-Control has to be on the location / which is the blog or /comments which is the nodebb?
-
@sanatisharif because developer of plugin set a filed
true
to usecookie
of forum foruser authentication
so you can't set*
asAllow grigin
. -
@Peter-Zoltan-Keresztes blog because blog send a request to forum!
-
I did the change to:
location / { add_header 'Access-Control-Allow-Origin' "http://z0z0.me"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header HOST $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:2369; proxy_redirect off; }
But still not able to get it working.
-
@Peter-Zoltan-Keresztes said:
I did the change to:
location / { add_header 'Access-Control-Allow-Origin' "http://z0z0.me"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header HOST $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:2369; proxy_redirect off; }
But still not able to get it working.
please give me
your forum url
andyour blog url
and completeerror on console
-
blog url is http://z0z0.me nodebb url http://z0z0.me/comments
Full error on the console:
16/12 18:22 [1593] - warn: [nodebb-plugin-blog-comments] Origin (undefined) does not match hostUrls: http://z0z0.me 16/12 18:26 [1593] - warn: [nodebb-plugin-blog-comments] Origin (undefined) does not match hostUrls: http://z0z0.me 16/12 18:28 [1593] - warn: [nodebb-plugin-blog-comments] Origin (undefined) does not match hostUrls: http://z0z0.me 16/12 18:28 [1593] - warn: [nodebb-plugin-blog-comments] Origin (undefined) does not match hostUrls: http://z0z0.me 16/12 18:30 [1593] - warn: [nodebb-plugin-blog-comments] Origin (undefined) does not match hostUrls: http://z0z0.me 16/12 18:30 [1593] - warn: [nodebb-plugin-blog-comments] Origin (undefined) does not match hostUrls: http://z0z0.me 16/12 18:32 [1593] - warn: [nodebb-plugin-blog-comments] Origin (undefined) does not match hostUrls: http://z0z0.me
Full nginx config:
server { listen 80; server_name z0z0.me; #charset koi8-r; access_log /var/log/nginx/z0z0/access.log main; error_log /var/log/nginx/z0z0/error_log; location / { add_header 'Acess-Control-Allow-Origin' 'http://z0z0.me'; # add_header 'Access-Control-Allow-Credentials' 'true'; # add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; # add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type, DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With'; proxy_set_header X-Real-IP $remote_addr; proxy_set_header HOST $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:2369; proxy_redirect off; } location /comments { # set $cors ''; # if ($cors = 'true') { # add_header 'Access-Control-Allow-Origin' "*"; # add_header 'Access-Control-Allow-Credentials' 'true'; # add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; # add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type, DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With'; # } # if ($request_method = 'OPTIONS') { # return 204; # } proxy_set_header X-Real-IP $remote_addr; proxy_set_header HOST $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:4567; proxy_redirect off; } }
-
@Peter-Zoltan-Keresztes Now I'm get it, you have xhr request to same domain but diffrent port,
Please commetset Alow origin
in nginx config. And thenreload nginx
and send me feedbacks!If still have problem @Peter-Zoltan-Keresztes I think block of nodebb (
/comments
) isn't true!So
/comment
block should be:proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:4567 proxy_redirect off;
Plus
3 lines of socket io support! See nodebb doccs!
-
I have updated my nginx config to match the documentation and my nginx config looks like this:
server { listen 80; server_name z0z0.tk www.z0z0.tk; return 301 $scheme://z0z0.me$request_uri; } server { listen 80; server_name z0z0.me; #charset koi8-r; access_log /var/log/nginx/z0z0/access.log main; error_log /var/log/nginx/z0z0/error_log; location / { # add_header 'Acess-Control-Allow-Origin' 'http://z0z0.me'; # add_header 'Access-Control-Allow-Credentials' 'true'; # add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; # add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type, DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With'; proxy_set_header X-Real-IP $remote_addr; proxy_set_header HOST $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:2369; proxy_redirect off; } location /comments { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Nginx-Proxy true; proxy_pass http://127.0.0.1:4567; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
And it still not working. I am getting the same error.
-
@Peter-Zoltan-Keresztes I have updated the proxy_pas config to http://127.0.0.1:4567/comments or /comments/ no change. No matter what I do I am getting the same warning message for most of the blog posts while for some of them is working fine.