News for hackers. Stuff that matters.
Re:Building an "Easy" Web Application by theincredulousk on Monday February 10, 2025 @12:57AM (#42997343)
not a web person - why does the original approach not have the CORS problem? Isn't it still generating the request from the same local machine?
Re:Building an "Easy" Web Application by kenny_r on Monday February 10, 2025 @01:29AM (#42997499)
CORS is enforced by the client, the web browser.

  +----------------------+                               +-----------------------+
  |     User Browser     |                               |     WordPress Site    |
  | (viewing from        |          CORS Error           |     (blog.com)        |
  |  example.com)        |     Browser enforces CORS     |                       |
  |    +------------+    |        Direct request         |    +------------+     |
  |    | Frontend   |<-----------------------------------X    | xmlrpc.php |     |
  |    | App        |    |     example.com → blog.com    |    |            |     |
  |    +------------+    |                               |    +------------+     |
  +----------------------+                               +-----------------------+
       Browser security blocks cross-origin
       requests (CORS is browser-only!)

The bottle app presumably uses some python library like Requests. It wouldn't care about CORS.

  +----------------------+     +------------------------+     +-----------------------+
  |     User Browser     |     |    App Server          |     |     WordPress Site    |
  | (viewing from        |     |    (example.com)       |     |     (blog.com)        |
  |  example.com)        |     |                        |     |                       |
  |    +------------+    |     |    +------------+      |     |    +------------+     |
  |    | Frontend   |<-------->|    | Backend    |<---------->|    | xmlrpc.php |     |
  |    | App        |    |     |    | (Bottle)   |      |     |    |            |     |
  |    +------------+    |     |    +------------+      |     |    +------------+     |
  +----------------------+     +------------------------+     +-----------------------+
           Same origin         Uses requests library           Different origin
       Browser allows this       No CORS checks here!         (Server doesn't care
                               (Not a browser!)                  about origin)
Re:Building an "Easy" Web Application by theincredulousk on Monday February 10, 2025 @02:01AM (#42997629)
makes sense, thank you. How'd you generate the diagrams so quickly?
Re:Building an "Easy" Web Application by kenny_r on Monday February 10, 2025 @05:12AM (#42998786)
My pleasure. Claude 3.5 Sonnet made the diagrams after 3 rounds of prompting.

LLM's are surprisingly good at making diagrams in monospaced ascii or MermaidJS.

Re:Building an "Easy" Web Application by mths on Monday February 10, 2025 @01:17AM (#42997444)
Also not a web person, but my guess is that the bottle app makes the requests from the "server" end, so even though you're accessing the app in your browser, the browser is only communicating with the local app server and thus isn't in the way to enforce CORS.
Re:Building an "Easy" Web Application by theincredulousk on Monday February 10, 2025 @02:02AM (#42997637)
you're right mostly, person above even created a nice diagram
Re:Building an "Easy" Web Application by mths on Monday February 10, 2025 @03:22AM (#42998015)
Can't compete with that!