Skip to content

Commit

Permalink
work around SSL error in production
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdulrhmnGhanem committed Nov 16, 2022
1 parent 9bb6a19 commit f71cd41
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,32 @@ module.exports = async phase => {
],
},
async redirects() {
const processorURLWithoutSSL = `http://processor.${process.env.KITSPACE_DOMAIN}${process.env.KITSPACE_EXTERNAL_PORT}`
const sslWorkaround = url => {
url = new URL(url)
url.protocol = 'http:'
return url.toString().slice(0, -1) // remove the trailing slash
}
// we use "_" as the project name when there is only one project but we
// don't want it to appear in the URL of the project page
return [
// Make the 1-click-bom.tsv file accessible to the 1-click-bom extension.
{
source: '/:user/:repo/:project/1-click-BOM.tsv',
destination: `${processorURLWithoutSSL}/files/:user/:repo/HEAD/:project/1-click-BOM.tsv`,
source: '/:user/:repo/_',
destination: '/:user/:repo',
permanent: true,
},
// Make the 1-click-bom.tsv file accessible to the 1-click-bom extension.
{
source: '/:user/:repo/1-click-BOM.tsv',
destination: `${processorURLWithoutSSL}/files/:user/:repo/HEAD/_/1-click-BOM.tsv`,
source: '/:user/:repo/:project/1-click-BOM.tsv',
destination: `${sslWorkaround(
process.env.KITSPACE_PROCESSOR_URL,
)}/files/:user/:repo/HEAD/:project/1-click-BOM.tsv`,
permanent: true,
},
{
source: '/:user/:repo/_',
destination: '/:user/:repo',
source: '/:user/:repo/1-click-BOM.tsv',
destination: `${sslWorkaround(
process.env.KITSPACE_PROCESSOR_URL,
)}}/files/:user/:repo/HEAD/_/1-click-BOM.tsv`,
permanent: true,
},
]
Expand Down

0 comments on commit f71cd41

Please sign in to comment.