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

How to setup Rendora correctly? Rendora does not return api call results #16

Open
Resoguy opened this issue Feb 7, 2019 · 2 comments
Open

Comments

@Resoguy
Copy link

Resoguy commented Feb 7, 2019

I have set up a server for my vue project, I installed caddy to serve my files up and running and its working, according to rendora docs I have installed and started chrome headless browser and have rendora up and running too with this config options:

{
  "backend": {
    "url": "http://127.0.0.1:80"
  },
  "target": {
    "url": "https://mywebsite.com"
  },
  "headless": {
    "waitAfterDOMLoad": 0,
    "internal": {
      "url": "http://127.0.0.1:9222"
    }
  },
  "output": {
    "minify": true
  },
  "filters": {
    "userAgent": {
      "defaultPolicy": "whitelist"
    }
  }
}

This is my Caddy config file:

https://mywebsite.com {

  root /opt/www.mywebsite/dist/

  # vue-router mode is 'history', so all urls should resolve to root.
  rewrite {
      regexp .*
      to {path} /
  }

  log {
      rotate_size 50   # Rotate after 50 MB
  }

}

when i check my netstat it looks like everything is ok but when i curl my website from my local terminal even my defaultPolicy is whitelist it doesn't return full html so i guess there is something wrong.

Is config files folder important? it is in the www.mywebsite folder with the dist/ folder. Is there a way besides curl-ing from my local to check rendora?

If it's not working what am i doing wrong?

@Resoguy
Copy link
Author

Resoguy commented Feb 8, 2019

So currently I have made something different and would like to ask if there is any better solution to my problem.

  1. I have a caddy server running on the front that listens :443 and :80 ports (because i couldn't configure rendora to listen those ports) with the setup to proxy localhost:3001 if user-agent is bot else directly give html and bundled js files from folder.

  2. Rendora runs with the config file that backend and target links are the second caddy running on a :8000 port that serves same static files with the first caddy.

  3. Second caddy server running on the back at :8000 port

So i have:

                    >======> dist/index.html
   CADDY:443 ======|
                    >======> RENDORA:3001 ========> CADDY:8000 ====> dist/index.html

Yes this is a working solution for me wether it's the best architecture or not but still I have a problem:

Rendora returns static app layout in my vue project perfectly but for example I have popular products in the main page as main content which i am fetching with axios in project but the document that rendora returns doesn't include api called content. What is the reason of this?

@Resoguy Resoguy changed the title How to check if it is working? How to setup Rendora correctly? Rendora does not return api call results Feb 11, 2019
@Resoguy
Copy link
Author

Resoguy commented Feb 13, 2019

I solved my empty product results issue:

My api calls are taking too much to display on DOM so rendora can't return products data because waitAfterDOMLoad was default 0ms. So you need to give some time to headless chrome to finish api calls and get data on the DOM.

Thanks for Rendora, Great tool.

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

1 participant