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

feat: boot all development servers with SSL by default #685

Closed
EmirBoyaci opened this issue Aug 20, 2023 · 2 comments
Closed

feat: boot all development servers with SSL by default #685

EmirBoyaci opened this issue Aug 20, 2023 · 2 comments

Comments

@EmirBoyaci
Copy link
Contributor

Describe the feature you would like to see added

As @emredevsalot mentioned here Twitch does only support secure (HTTPS) urls. To use Twitch auth strategy in Pasaport, we need to run Pasaport via SSL. Then, @usirin draw forth an idea to boot all development servers with SSL by default.

We can do that via local-ssl-proxy which grabs the source port and publishes new port with SSL. See example usage below:

# install concurrently to run multiple commands concurrently
npm install -g concurrently

# run 'npm run dev' and 'npx local-ssl-proxy --target 3000 --source 3001' concurrently
# you can change 'target' and 'source' parameters
# since target port '3000' is default port for Next.js server I keep this and make source as '+1'
concurrently "npm run dev" "npx local-ssl-proxy --target 3000 --source 3001"

If we do what I described above, we will able to access HTTP on port 3000 and HTTPS on port 3001 for example which makes things easier.

BREAKING CHANGE: If we are not writing cookies via secure property, we might get some troubles via accessing cookies from HTTPS websites? (might be the case, just FYI)

See output below:
output of 'concurrently "npm run dev" "npx local-ssl-proxy --target 3000 --source 3001"'

cc/ @emredevsalot @usirin @gurkanguray

Describe alternatives you have considered

No response

Additional context

No response

@emredevsalot
Copy link
Collaborator

I got an error with the 3001 port, I guess it was because it conflicts with pasaport trying to run on the same port.

I changed the source as --source 8001 and ran the command. The app works as expected without SSL URLs, but when I try to access with https, I get the following error.

image

Has anyone else tried this? Maybe it's on my end.

@EmirBoyaci
Copy link
Contributor Author

EmirBoyaci commented Aug 22, 2023

I got an error with the 3001 port, I guess it was because it conflicts with pasaport trying to run on the same port.

I changed the source as --source 8001 and ran the command. The app works as expected without SSL URLs, but when I try to access with https, I get the following error.

image

Has anyone else tried this? Maybe it's on my end.

I just tried and it works, maybe it's because you're running on Windows? IDK why it's like that but could you please try in the terminal?

# go to pasaport directory (full path: monorepo/apps/pasaport)
cd /monorepo/apps/pasaport

# install concurrently to run multiple commands concurrently
npm install -g concurrently

# run 'npm run dev' and 'npx local-ssl-proxy --target 3001 --source 9001' concurrently
# ! THIS ENSURES THAT PORT '9001' IS AVAILABLE !
concurrently "npm run dev" "npx local-ssl-proxy --target 3001 --source 9001"

# if you do not have wget you can install
winget install -e --id JernejSimoncic.Wget

# try to fetch HTTP
wget http://pasaport.localhost.kamp.us:3001/

# try to fetch HTTPS
wget https://pasaport.localhost.kamp.us:9001/ --no-check-certificate

See example output:
image

If your output is different than mine, something doesn't work on Windows. If you can share your output we can look together.

P.S. getting 404 error is fine since there is no Next.js entrypoint on root path (/)

@usirin usirin closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2023
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in monorepo pasaport Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

3 participants