Hello All,
I am doing using Express middleware mode with ip address it’s working . But now i want to check import from RemoteSources. For that i have added domain and self signed certificate.
My companion url is : https://uppyuploader.4printshop.com:2022/.
Here is my server.js
require(‘dotenv’).config()
const express = require(‘express’)
const companion = require(‘@uppy/companion’);
const path = require(‘path’);
const app = express()
const port = process.env.PORT ?? 2022
const bodyParser = require(‘body-parser’);
const session = require(‘express-session’);
const fs = require(‘fs’);
const https = require(‘https’);
app.use(bodyParser.json());
app.use(
session({
secret: ‘ad@4545454’,
resave: true,
saveUninitialized: true,
}),
);
app.get(‘/design’, (req, res) => {
res.sendFile(path.join(__dirname, ‘public’, ‘index.html’));
});
const companionOptions = {
providerOptions: {
instagram: {
key: ‘4544545’,
secret:‘45454545456’
},
server: {
host: ‘uppyuploader.4printshop.com:2022’,
protocol: 'http',
validHosts:['uppyuploader.4printshop.com:2022','uppyuploader.4printshop.com','4printshop.com:2022','4printshop.com'],
// corsOrigins: ['*'],
// uploadUrls: ['*'],
},
filePath: ‘./download’,
corsOrigins: [‘'],
secret: '4545898989’,
validHosts:[‘uppyuploader.4printshop.com’],
debug: true,
sendSelfEndpoint:‘uppyuploader.4printshop.com:2022’
};
const { app: companionApp } = companion.app(companionOptions);
app.use((req, res, next) => {
res.setHeader(‘Access-Control-Allow-Origin’, req.headers.origin || ‘*’);
res.setHeader(
‘Access-Control-Allow-Methods’,
‘GET, POST, OPTIONS, PUT, PATCH, DELETE’,
);
res.setHeader(
‘Access-Control-Allow-Headers’,
‘Authorization, Origin, Content-Type, Accept’,
);
next();
});
app.use(companionApp);
app.use((req, res, next) => {
return res.status(404).json({ message: ‘Not Found’ });
});
companion.socket(app.listen(port));
console.log(‘Welcome to Companion!’);
console.log(Listening on https://uppyuploader.4printshop.com:
+port);