Disable https for specific api routes?
I have an API which a very old game is trying to send data to. This old application (circa 2004) cannot handle HTTPS. It must use HTTP.
Is there a way to configure my
wrangler.toml
to specify specific routes for my Pages project to use HTTP instead of HTTPS?65 Replies
You could have your Worker redirect based on the protocol?
Hmmm. Im still a little bit new to the terminology. I thought I was using "Pages" and I thought "Workers" were something else? Or are "Pages" a super set of "Workers" in a way?
@HardlyWorkin' I have also created a Page Rule (after reading some SO post)
Do you think this is the right direction?
![No description](https://cdn.answeroverflow.com/1209205508238741534/image.png)
After I did this, I get this:
![No description](https://cdn.answeroverflow.com/1209205582410817606/image.png)
in my "Pages" project, I have this file:
/functions/api/submit.ts
Since I am working with Pages I assumed I'd use Page rules?
![No description](https://cdn.answeroverflow.com/1209206299842314331/image.png)
No, Page Rules are something else, and are no longer recommended for use
Pages and Workers are two separate products, but they do share some commonalities. You cannot configure your Pages Project with
wrangler.toml
for deploymentAlright - are you suggesting I move my API logic from my Pages project and into its own "Worker"?
No, you can keep it in Pages. In fact, this shouldn't require any changes to configuration.
Thanks! Still unclear on how to use HTTP though.
Do I need to configure a worker rule?
Confused about this because I am using Pages - so the naming is confusing me
This is my project repo. I have my
functions
directory which contains my API and my site
directory which is my static website which Pages automatically deploys for me when I push to my repo. (Lovely btw)![No description](https://cdn.answeroverflow.com/1209208024573681754/image.png)
So from my perspective, I am using "Pages" and I have "Functions" inside my Pages project
![No description](https://cdn.answeroverflow.com/1209208250847985725/image.png)
so what am I supposed to do to get this /api/submit route working with HTTP?
Do you only want it to apply to
/api/submit
, or to the entirety of /api
?