FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
curtcox
curtcoxmlbdotcom
Public
Like
mlbdotcom
Home
Code
3
untitled-folder-2264
1
README.md
H
index.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
index.ts
https://curtcox--91125b9eeba74077b06817ee212c620e.web.val.run
README.md

MLB Proxy Val

This Val Town val serves as a proxy to https://mlb.com/, transforming responses to ensure all links continue through the proxy and adding a help widget to each page.

Features

  • Proxies all requests to mlb.com
  • Transforms HTML responses to rewrite links (both absolute and relative)
  • Adds a help widget to the lower right corner of each page
  • Maintains original headers and status codes
  • Passes through non-HTML content unchanged

Help Widget

The help widget appears as a blue button in the lower right corner of each page. Currently, it displays an alert when clicked, but it's designed to be easily modified for more advanced functionality.

Modifying the Help Widget

The help widget is implemented in a modular way through the getHelpWidgetHtml() function. To change its appearance or functionality:

  1. Locate the getHelpWidgetHtml() function in the code
  2. Modify the HTML, CSS, or JavaScript as needed
  3. The widget's functionality is contained within the embedded script tag

Implementation Details

  • The proxy uses standard fetch API to forward requests
  • URL transformation handles both absolute and relative URLs
  • The widget is injected before the closing </body> tag when possible
HTTP
  • index.ts
    curtcox--91…0e.web.val.run
Code
untitled-folder-2264README.md
H
index.ts
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.