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

Update amp-first example to use GSSP #11028

Merged
merged 1 commit into from Mar 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/amp-first/pages/index.js
Expand Up @@ -234,10 +234,10 @@ const Home = props => (
)

// amp-script requires absolute URLs, so we create a property `host` which we can use to calculate the script URL.
Home.getInitialProps = async ({ req }) => {
export async function getServerSideProps({ req }) {
// WARNING: This is a generally unsafe application unless you're deploying to a managed platform like ZEIT Now.
// Be sure your load balancer is configured to not allow spoofed host headers.
return { host: `${getProtocol(req)}://${req.headers.host}` }
return { props: { host: `${getProtocol(req)}://${req.headers.host}` } }
}

function getProtocol(req) {
Expand Down