Mocking HTTPS and URL
Answered
David L. Bowman posted this in #help-forum
I'm working with some APIs which require me to mock an HTTPs and actual url, they reject :3000 or whatever. What's the best way for me to get this working so I can test in a dev environment.
Answered by David L. Bowman
@iyxan23 & @Havana , i was able to solve the problem by following these steps:
1. creating an ngrok account.
2. running:
3. running:
4. changed
1. creating an ngrok account.
2. running:
ngrok config add-authtoken ${authToken}
3. running:
ngrok http --domain=${ngrokUrl}.app 3000
4. changed
package.json
dev
script to next dev --experimental-https
28 Replies
so essentially you need an HTTPS endpoint that tunnels to your
localhost
dev server?oh hey david didn't notice it was you lol
Hey 😄
I actually figured out the HTTPS part, but now i'm trying to get it to go to something like https://example.com but that actually be my localhost env.
the issue is authorize.net doesn't let me test on localhost, and i dont' want to push to a static staging url everytime i make a chagne.
is it for webhook notifications? or something?
it's for a redirect, it's very annoying
also what test are you trying to do with authorize.net?
oh its just a redirect
i wonder if i just change to port 80
Havana
What about using ngrok?
It will port forward from 80 or 443 (not sure), to the local 3000
The only issue is that the generated link will always change when you restart the ngrok
mm yeah that could work
Havana
Thats the purpose of port forwarding
Forwarding from an external port that somebody wants to access, to a local port
So if you use it anywhere, you will always have to change it, kind of annoying
Or you could buy VPS/VDS, and then use nginx
decent enough for testing
Havana
Sure
since it's for a redirect, booting up a simple github pages with just
<script>window.href = "localhost:3000/";</script>
might work lolHavana
ofc
just change the link to the ngrok link
That's how I tested, it works both in dev and prod modes
i could try that.
@iyxan23 & @Havana , i was able to solve the problem by following these steps:
1. creating an ngrok account.
2. running:
3. running:
4. changed
1. creating an ngrok account.
2. running:
ngrok config add-authtoken ${authToken}
3. running:
ngrok http --domain=${ngrokUrl}.app 3000
4. changed
package.json
dev
script to next dev --experimental-https
Answer
Havana
Good job
Glad I could help