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

Chore | Improve gatsby-plugin-nginx configurability #747

Merged
merged 2 commits into from
Jun 2, 2021

Conversation

tlgimenes
Copy link
Contributor

What's the purpose of this pull request?

This PR improves gatsby-plugin-nginx configurability by allowing it to:

  1. Add custom server block options
  2. Add custom http block options
  3. Create redirects with more than one variable

How it works?

The first and second improvements are easy to understand. Basically, there is a new option to add custom nginx rules to the http and server block options. This gives people using this plugin more flexibility in terms of how they use the plugin and their nginx in their infrastructure.

The third point is more interesting. Before this PR, one could only write redirects like this:

createRedirect('/foo/*', '/bar/:splat')

Note that :splat had to be written exactly like this. Creating redirects with a different name, say: /bar/:rest broke the plugin. This PR fixes this problem. Also, another problem we are fixing is being able to use variables. Before, one could write:

createRedirect('/foo/:slug', '/bar/:slug')

Also, the :slug variable name mattered. Now, we can write redirects like:

createRedirect('/foo/:p1/:p2', '/bar/:p2/:p1')

How to test it?

There is a jest that I added some cases like this to test it.

@netlify
Copy link

netlify bot commented Jun 2, 2021

✔️ Deploy Preview for storeui ready!

🔨 Explore the source changes: 04241da

🔍 Inspect the deploy log: https://app.netlify.com/sites/storeui/deploys/60b7f33b7c40780007f0263d

😎 Browse the preview: https://deploy-preview-747--storeui.netlify.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 2, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 04241da:

Sandbox Source
Store UI Typescript Configuration

@tlgimenes tlgimenes marked this pull request as ready for review June 2, 2021 12:56
@tlgimenes tlgimenes requested a review from a team as a code owner June 2, 2021 12:56
@tlgimenes tlgimenes requested a review from MMartyn June 2, 2021 12:56
@eric-pigeon eric-pigeon self-requested a review June 2, 2021 12:57
@tlgimenes tlgimenes mentioned this pull request Jun 2, 2021
Copy link
Contributor

@MMartyn MMartyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tlgimenes tlgimenes force-pushed the chore/improve-nginx-for-thumbor branch from 45f38fd to 04241da Compare June 2, 2021 21:08
@tlgimenes tlgimenes merged commit 97a7fef into master Jun 2, 2021
@tlgimenes tlgimenes deleted the chore/improve-nginx-for-thumbor branch June 2, 2021 21:30
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

Successfully merging this pull request may close these issues.

2 participants