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 can I deploy the sites to a CDN? #1369

Closed
magicly opened this issue Jul 5, 2017 · 3 comments
Closed

how can I deploy the sites to a CDN? #1369

magicly opened this issue Jul 5, 2017 · 3 comments

Comments

@magicly
Copy link
Contributor

magicly commented Jul 5, 2017

hi, I want to deploy all files(including pics/js/css/font) except index.html to my CDN, e.g. http://cdn.example.com, but deploy index.html to my main site: http://www.example.com. Is it possible? I work around for several hours, including set

pathPrefix: 'http://cdn.example.com'

in gatsby-config.js.
or modify webpack config in gatsby-node.js

exports.modifyWebpackConfig = ({config, stage}) => {
  config.merge({
    output: {
      publicPath: 'http://localhost:50000000000/',
    }
  })

  return config;
}

In create-react-app, I just need to set PUBLIC_URL and in webpack I just need to set publicPath in output.

Is there sth I missing? Any help is welcome. Thanks~
I use https://github.com/gatsbyjs/gatsby-starter-blog/tree/1.0 as a starter, so the package.json file is the same.

@KyleAMathews
Copy link
Contributor

KyleAMathews commented Jul 5, 2017 via email

@whmountains
Copy link

whmountains commented Jul 5, 2017

Netlify is a good option if you're looking for something hosted. They also have an auto-deploy feature that knows how to build Gatsby sites so you don't have to set up CI.

@prateek3255
Copy link

For anyone else who wanders on this issue, this can now be achieved using the assetPrefix option introduced with this PR - #12128

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

4 participants