Skip to content

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

@magicly

Description

@magicly

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions