How do I disable resolving login parameters passed as url parameters / from the url
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Passing login credentials (username, password) as URL query parameters is a serious security vulnerability. URLs are logged in browser history, server access logs, proxy logs, and referrer headers, meaning credentials end up in plaintext in multiple locations. This article explains how to disable URL-based login parameters in common frameworks and enforce secure alternatives.
Why URL Parameters for Login Are Dangerous
This exposes credentials in:
- Browser history: Anyone with access to the browser can see the URL
- Server access logs: Apache/Nginx access logs record full URLs by default
- Proxy and CDN logs: Corporate proxies, load balancers, and CDNs log URLs
- Referrer headers: If the user navigates to another site after login, the full URL is sent in the
Refererheader - Browser bookmarks: Users may accidentally bookmark the URL with credentials
- Shoulder surfing: The URL is visible in the address bar
Spring Security (Java)
Spring Security can process login credentials from both URL parameters and POST body. To restrict to POST only:
Spring's UsernamePasswordAuthenticationFilter only processes POST requests by default. To explicitly enforce this and reject GET requests with credentials:
Express.js (Node.js)
Middleware to strip credentials from query parameters:
Django (Python)
Django's LoginView uses POST by default. Add explicit GET rejection:
Add middleware to strip credentials from all URLs:
ASP.NET Core
Nginx / Apache: Strip Parameters at the Web Server Level
Nginx
Redirect requests containing credentials in the URL:
Apache
HTML Form Best Practice
Ensure your login form uses POST:
Secure Alternatives
| Method | Security Level | Notes |
| POST body over HTTPS | Good | Standard approach |
| Authorization header (Basic) | Good | Base64 encoded, requires HTTPS |
| Authorization header (Bearer) | Best | Token-based, no credentials in transit |
| OAuth 2.0 / OpenID Connect | Best | Delegated authentication |
| Secure cookies | Good | HttpOnly, Secure, SameSite flags |
Common Pitfalls
- HTTPS does not protect URLs in logs: While HTTPS encrypts the URL in transit, the URL (including query parameters) is still visible in server logs, browser history, and referer headers. HTTPS alone does not make URL credentials safe.
- Tokens and Cookies: Use secure tokens or cookies for session management. Set
HttpOnly,Secure, andSameSiteflags on session cookies. - API keys in URLs: Some APIs pass keys as query parameters (
?api_key=...). This has the same logging exposure. Prefer sending API keys in theAuthorizationheader. - Client-side redirects: JavaScript redirects like
window.location = '/dashboard?token=...'expose tokens in browser history. Usehistory.replaceState()to strip the parameter immediately after reading it. - Logging middleware: Audit your logging configuration. Many logging frameworks record full request URLs by default. Configure them to redact sensitive parameters.
Summary
- Never pass login credentials as URL query parameters — they end up in logs, history, and referrer headers
- Enforce POST-only login endpoints in your framework (Spring Security, Express, Django, ASP.NET)
- Add middleware to reject requests with sensitive parameters in the URL
- Use HTTPS with POST body, Authorization headers, or token-based authentication
- Configure web servers (Nginx/Apache) as an additional defense layer

