This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package study.hard.spring.core.commons.util | |
import java.io.BufferedReader; | |
import java.io.ByteArrayInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.nio.charset.Charset; | |
import java.nio.charset.StandardCharsets; | |
import java.util.ArrayList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
@Override | |
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { | |
RereadableRequestWrapper rereadableRequestWrapper = new RereadableRequestWrapper((HttpServletRequest)request); | |
... | |
chain.doFilter(rereadableRequestWrapper , response); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<error-page> | |
<error-code>404</error-code> | |
<location>/error/pageNotFound</location> | |
</error-page> | |
<error-page> | |
<exception-type>java.lang.Throwable</exception-type> | |
<location>/error/unknownException</location> | |
</error-page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping("/error") | |
@Controller | |
public class ErrorController { | |
@RequestMapping("/pageNotFound") | |
@ResponseBody | |
public Response pageNotFound() { | |
return new ErrorResponse(ErrorCode.NOT_FOUND_API.getCode(), ErrorCode.NOT_FOUND_API.getMessage()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# FastCGI-to-WSGI bridge for files/pipes transport (not socket) | |
# | |
# Copyright (c) 2002, 2003, 2005, 2006 Allan Saddi <[email protected]> | |
# Copyright (c) 2011 Ruslan Keba <[email protected]> | |
# Copyright (c) 2012 Antoine Martin <[email protected]> | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models import Sum | |
class AbsoluteSum(Sum): | |
name = 'AbsoluteSum' | |
template = '%(function)s(%(absolute)s(%(expressions)s))' | |
def __init__(self, expression, **extra): | |
super(AbsoluteSum, self).__init__( | |
expression, absolute='ABS ', output_field=IntegerField(), **extra) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set $cors ""; | |
if ($http_origin ~ '^(https)?\:\/\/(local\.)?(dev|www)\.(domain|seconddomain)\.com')) { | |
# if ($http_origin ~ '^(https)?\:\/\/([\w\d\.]*){2,}(domain|seconddomain)(\.co)?\.kr') { | |
set $cors "true"; | |
} | |
location /test { | |
if ($cors = "true") { | |
add_header Access-Control-Allow-Origin "$http_origin"; | |
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
... | |
server_name exposed.domain.com; | |
... | |
location / { | |
proxy_pass "http://internal.domain.com:1234"; | |
proxy_pass_request_headers on; | |
proxy_set_header Host $host; | |
proxy_redirect "http://exposed.domain.com:1234" "https://exposed.domain.com"; | |
} |