https://discord.cloudflare.com logo
Join Discord
Powered by
# workers-discussions
  • s

    sathoro

    04/25/2023, 2:51 PM
    oh, wow...
  • j

    James

    04/25/2023, 2:52 PM
    3k lines? Oh wow, yeah good luck
  • s

    sathoro

    04/25/2023, 2:52 PM
    I'm so close to doing a
    replace(/<[^>]*>?/gm, '')
  • s

    sathoro

    04/25/2023, 2:53 PM
    I'm trying to understand why it is so complex
  • s

    sathoro

    04/25/2023, 2:55 PM
    that won't work for stripping everything inside
    script
    tags and such but since it is already run through readability that should all be stripped anyways...
  • j

    James

    04/25/2023, 2:55 PM
    Parsing HTML with regex is generally a bad idea
  • j

    James

    04/25/2023, 2:55 PM
    See https://stackoverflow.com/a/1732454 😅
  • j

    James

    04/25/2023, 2:56 PM
    It might work for simple stuff, but you'll probably end up chasing edge-cases
  • s

    sathoro

    04/25/2023, 2:56 PM
    oh for sure, but we are just stripping HTML out and it has already been run through readability at least
  • s

    sathoro

    04/25/2023, 3:01 PM
    also with how we are using the HTML, if it fails even 1% of the time it isn't a big deal
  • j

    James

    04/25/2023, 3:03 PM
    then that might be a way quicker solution, yeah 🙂
  • f

    frankjonen

    04/25/2023, 3:43 PM
    Can someone point me in the right direction to get a simple contact form to work on Pages? I've tried https://github.com/yhorian/pages-plugin-mailchannels but that only results in some error with creating a PHP script in some
    includes
    folder where the
    .js
    file name is the script:
    …pages.dev/includes/contact.php
    that has the same content as the index.html. Is it actually possible to do that on Cloudflare? I was thinking of switching from AWS.
  • k

    kian

    04/25/2023, 3:46 PM
    What's the full error that you're getting?
  • f

    frankjonen

    04/25/2023, 3:56 PM
    [Error] Failed to load resource: the server responded with a status of 405 () (contactform.php, line 0)
    I just put it back up for testing,
    https://fjtest.pages.dev
    the mail form is at the bottom, clicking it errors the form with undefined and creates the error log.
  • k

    kian

    04/25/2023, 3:57 PM
    Is contactform.php one of your files? Pages can’t run PHP
  • f

    frankjonen

    04/25/2023, 3:59 PM
    I have no idea where that comes from. All I did was add the
    functions/_middleware.ts
    from the pages plug-in and added my email address to it.
  • h

    HardAtWork

    04/25/2023, 4:00 PM
    Looks like your contact form attempts to submit to
    contactform.php
    maybe?
  • f

    frankjonen

    04/25/2023, 4:02 PM
    The form doesn't do anything. The plugin states that there should be no
    POST
    action, that the plug-in acts on any form carrying
    data-static-form-name="contact"
    .
  • h

    HardAtWork

    04/25/2023, 4:08 PM
    That forked repo looks odd. Does it work if you use this plugin instead? https://developers.cloudflare.com/pages/platform/functions/plugins/mailchannels/
  • f

    frankjonen

    04/25/2023, 4:12 PM
    It seems that type of script creates PHP files.
    https://ff150b35.fjtest.pages.dev/includes/contactform.php
    that then don't work. You can look at the HTML, there's nothing calling for a
    contactform.php
    .
  • s

    sathoro

    04/25/2023, 4:16 PM
    is there any chance for getting an increase of the 6 parallel subrequests?
  • k

    kian

    04/25/2023, 4:16 PM
    You could request it at but I have no idea if that's one that is raised
  • h

    HardAtWork

    04/25/2023, 4:18 PM
    I don't see an error either...
  • h

    HardAtWork

    04/25/2023, 4:18 PM
    Is it showing up in the Network log somewhere?
  • s

    sathoro

    04/25/2023, 4:20 PM
    thanks, we will see what happens 🙂
  • f

    frankjonen

    04/25/2023, 4:22 PM
    jquery. Just great. Blocs added that in their form verification script. — Now at least I have no errors, just a _middleware script that does nothing.
  • b

    bret_pat

    04/25/2023, 5:27 PM
    Is there a way to publish to cloudflare queues from AWS lambda? Something like an SDK?
  • m

    Mozzy

    04/25/2023, 5:34 PM
    Just doing some brainstorming. Currently building a very simple application where the user can enter text into an input, then give that text to an API which then returns a response. I have a simple client-side cooldown after each attempt set at 4 seconds. Let's say I want to implement a Worker-side cooldown based on the user's IP. If the cooldown is 4-5 seconds, would KV suffice? Would it be consistent enough?
  • u

    Unsmart | Tech debt

    04/25/2023, 6:07 PM
    You would have to call a cloudflare worker and then add to queue
  • m

    Mozzy

    04/25/2023, 6:09 PM
    I've implemented it in KV and it does what I need it to do, it seems. Are there situations where
    request.headers.get("x-real-ip")
    will not be there?
1...241624172418...2509Latest