Reverse proxy + nocode api - Urlencode needed like it or not

Since I don’t have much time and I’m just posting for public awareness will share my experience here using:

  • nocodeapi
  • airtable

I decided to use nocodeapi and set up my own reverse proxies to avoid exposing sensible information such as api keys frontend side and also to get api branded with my domain.

Everything went fine until I found out that ultimately, part of the reverse proxy rewriting needs to be URL encoded, otherwise it won’t work. Not sure if this is intended or not, but took some time to get it going.

So what apparently would work like this:

   items.mydomain.com {
             rewrite * /mydomain/airtable/nocodekey?tableName=shop_list&id={query}
             reverse_proxy https://v1.nocodeapi.com {
                      header_up Host "v1.nocodeapi.com"
                     header_up X-Real-IP {http.request.remote}
                     header_up X-Forwarded-For {http.request.remote}
                     header_up X-Forwarded-Port {http.request.port}
                     transport http {tls}
             }
     }

Needs to end up rewritten like:

   items.mydomain.com {
             rewrite * /mydomain/airtable/nocodekey?tableName=shop_list&id=%3D%7Bquery%7D
             reverse_proxy https://v1.nocodeapi.com {
                      header_up Host "v1.nocodeapi.com"
                     header_up X-Real-IP {http.request.remote}
                     header_up X-Forwarded-For {http.request.remote}
                     header_up X-Forwarded-Port {http.request.port}
                     transport http {tls}
             }
     }

Don’t try to url encode the rest of the “rewrite” text, it won’t work. It will just work with the last part of it. I had no other way but to discover this by testing out, fragment by fragment.

Just wanted to share this small steps in case anyone is having the same issues; this could save time.
Additionally, not sure if this even can be considered a bug or an issue, in this case, its not the point of this post, just setting up this small guide.

Finally to url encode easily I used https://www.urlencoder.org/ guess there are many other online options but that’s the first one that came up to me in results.

Not exactly same issue but since I’m using nocode + airtable api I’m continuing previous thread

Upon latest checks the “?” messes ups things proxy side:

So a request going like:

rewrite * /airtable/nodecodeapi{item}

Would work if browser url goes with mydomain/?tableName=shop_list&filterByFormula=shop_offers="reccDNAEN9erSpQ"

It won’t work if I try to add more stuff into the proxy to build a more clear url because then:

rewrite * /airtable/nodecodeapi?tableName=shop_list&filterByFormula=shop_offers={item}

When called via mydomain/?reccDNAEN9erSpQ or any variation of this one (I tried all combinations) fails.

No matter what, seems “?” in the rewrite string somehow blocks the {item} stuff provided via url (which is much more cleaner than previous approach) and I’m always getting that “item” cannot be found from airtable as a response, meaning Caddy is basically not reading/converting/passing that part.

Again, not sure if this is intended or right or an issue. My knowledge is limited so I’m just pointing a limitation that sounds me strange when using caddy.

Best regards,

This topic was automatically closed after 29 days. New replies are no longer allowed.