Giter VIP home page Giter VIP logo

Comments (6)

mattma avatar mattma commented on March 28, 2024 1

Although I know egg server can serve a static webpage, i want to scale my client side and node.js server side separately in two docker containers managed by kubernetes. so that they are not bundled inside a same container as a single process. Kubernetes can handle scale them separately based on the resources.

from egg.

popomore avatar popomore commented on March 28, 2024

The page and the rest api have a different port, so if you request using ajax, server should return Access-Control-Allow-Origin header.

It seems the origin config in cors has some problem. You can try simply override the function in https://github.com/eggjs/egg-cors/blob/master/app.js#L12 and return '*' to fix it.

from egg.

popomore avatar popomore commented on March 28, 2024

@fengmk2 这个是不是放 config,这样可以直接在 config 里覆盖方法了。

https://github.com/eggjs/egg-cors/blob/master/app.js#L12

from egg.

mattma avatar mattma commented on March 28, 2024

@popomore Confirmed. It works like charm. Is it a bug in egg-kors?

I believe if user turns on cors via exports.cors = true inside plugin.js. It should provide with * as default options. Then user should be able to customize its own whitelist.

from egg.

mattma avatar mattma commented on March 28, 2024

@popomore @fengmk2

It is not a bug. We can safely close it and we may need to document it somewhere so that other users do not run into this issue since it is not clear where to configure the whitelist.

Here is how I fixed it without modify source code of egg-cors.

// config.local.js
module.exports = {
  security: {
    // value is the full url in a string format
    domainWhiteList: ['http://localhost:4200']
  }
};

from egg.

popomore avatar popomore commented on March 28, 2024

Why your angular app and rest api are starting at different server, the
best practice is Do everything in egg server.

We should add some view example.
Matt Ma [email protected]于2016年8月15日 周一上午11:52写道:

Closed #45 #45.


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#45 (comment), or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAWA1U2jEtDetB--5wqr1FvHbQvCIc4Oks5qf-JzgaJpZM4Jj8BD
.

from egg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.