[nodebb-plugin-blog-comments] Blog Commenting Engine (Ghost, Wordpress widget)


  • @sanatisharif said:

    set resp.http.Access-Control-Allow-Origin = "http://z0z0.me";
    That is syntax in varnish vcl for others google how 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 use cookie of forum for user authentication so you can't set * as Allow 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 and your blog url and complete error 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 commet set Alow origin in nginx config. And then reload 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.


  • Any other suggestion which might help me make this plugin fully work?


  • @Peter-Zoltan-Keresztes
    I don't know, I have another problem with this plugin:

    one of topics will be purge from my forum and now I can't publish it again!!!


  • Is there any way I can debug the plugin to see what is the exact url which is getting or what is the response?


  • It seam to me that it cannot read the origin url for some reason.


  • Anyone any suggestion? I would assume no one is using it with Ghost.


  • I have upgraded the node to the latest version of version4 but that did not helped at all.


  • @Peter-Zoltan-Keresztes I do and it works just fine.


  • @AOKP Interesting, but I don't understand why I am having these issues.


Suggested Topics

| | |

© 2014 – 2022 NodeBB, Inc. — Made in Canada.